This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Need to replace target link with link stored in title

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Need to replace target link with link stored in title

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #19366
    Randy93552Randy93552
    Participant

    I followed the knowledgebase entry at https://wp-dreams.com/knowledge-base/how-to-change-the-results-url-to-something-else and it does work, but the plugin is using the regular wordpress post title to store the URL I need, which is the one example not included in the examples in the knowledgebase. I have a feeling that it would be a version of the simpler example, where they just assign the constant for google, but I don’t know what variable to use for the post title.

    I have tried $post_title
    $post_title[$k]
    $r->title
    $r->title[$k]
    and none of those have worked.

    Can you help?

    #19368
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Sure! Try this variation, this should work:

    In the example there was no $r variable referenced, that is why the $r->title did not work for you.

    #19369
    Randy93552Randy93552
    Participant

    You cannot access this content.

    #19372
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Thank you, that screenshot actually helped. I think I understand what is going on now. So the problem is, that the code will only replace the link with the title that is already a custom field value, that’s why it is incorrect. Requesting it again from the database will do the trick:

    I have installed that plugin to test it with this code, this one should work now.

    #19382
    Randy93552Randy93552
    Participant

    Perfect! Thanks so much!

    #19385
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Need to replace target link with link stored in title’ is closed to new replies.