Wrong link in search result

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Wrong link in search result

This topic contains 12 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 3 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #40722
    Peter Sippel
    Peter Sippel
    Participant

    Hi.

    Sorry to come up with another issue I have:
    On my testing site I have configured, a search on a term found in a document runs fine and links to the right blog article. I imported this search in production and the search beaviour differs, although the search configuration is exactly the same. The link in the search result is different though:

    Test (working):
    https://tkcdev3.wpengine.com/generic/excel-att-test/?asp_highlight=acw&p_asid=1

    Prod (not working):
    https://tkc.temenos.com/?post_type=generic&p=8414&asp_highlight=acw&p_asid=3

    I’m using a code snippet provided by you earlier, but both, test and prod, are using the same:
    add_filter(‘asp_results’, ‘asp_return_posts_by_attachment_results’);
    function asp_return_posts_by_attachment_results($results) {
    $ids = array();
    $parent_ids = array();
    $new_results = array();
    // Gather existing post results first
    foreach($results as $k=>&$r){
    if ( isset($r->post_type) || $r->content_type == ‘comment’ ) {
    if ( $r->content_type == ‘comment’ ) {
    $parent_ids[] = $r->post_id;
    unset($results[$k]);
    } else if ( $r->post_type == ‘attachment’ ) {
    $parent_ids[] = wp_get_post_parent_id($r->id);
    unset($results[$k]);
    } else {
    $ids[] = $r->id;
    }
    }
    }
    $parent_ids = array_unique(array_diff($parent_ids, $ids, array(0)));
    foreach ( $parent_ids as $id ) {
    $res = new stdClass();
    $res->id = $id;
    $res->title = get_the_title($id);
    $res->content = get_post_meta( $id, ‘summary’, true); // ##psi get_the_content(null, false, $id);
    $res->image = get_the_post_thumbnail_url($id);
    $res->content = wd_substr_at_word(strip_tags($res->content), 130);
    $res->post_type = get_post_type($id);
    $res->link = get_permalink( $id );
    $res->content_type = ‘pagepost’;
    $res->date = @date_i18n(get_option(‘date_format’, “Y-m-d”) . ” ” . get_option(‘time_format’, “H:i:s”), get_post_time(‘U’, false, $id));
    $res->author = get_the_author_meta( ‘display_name’ , get_post_field (‘post_author’, $id));
    $new_results[] = $res;
    }

    return array_merge($new_results, $results);
    }

    There’s another behaviour, that might be related:
    When I change configuration on test env, all good. On prod however, I get blocked by our cloudflare proxy. Not sure why this is coming up on saving the config.

    Any idea ?

    Thanks
    Peter

    #40744
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Peter,

    If the links are different, then check your permalink settings on the wordpress back-end dashboard ( Settings -> Permalinks menu ).
    The second link simply looks as if the permalinks are not enabled, it is the default link structure for WordPress with the query arguments.

    The cloudflare proxy issue might be a false positive flag for the cloudflare firewall or something similar. Maybe it sees part of the request similar to a threat or something like that and it automatically blocks it. Try checking the cloudflare settings, maybe you can adjust the firewall or add an exception for the back-end pages.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40751
    Peter Sippel
    Peter Sippel
    Participant

    Hi Ernest,

    thanks for your reply. Both sites have Permalink structure as “Post Name”. The test site was cloned from prod, so most settings should be the same.

    Regards
    Peter

    #40752
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Is there a specific search phrase I should try? On my end all links are correct in the search results: https://i.imgur.com/06iJqVf.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40759
    Peter Sippel
    Peter Sippel
    Participant

    Hi Ernest.

    I have attached some images. The first one shows the item where I saw the probem first. The search key was in an excel file, which was linked in the article.
    The second image shows the search and on the bottom the wrong link already, which leads to 404.
    Last image shows, in dev, the same search key found in the excel file with a link in a test article. This time correct link and opens the page.

    Regards
    Peter

    Attachments:
    You must be logged in to view attached files.
    #40770
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay.

    Are you sure that the “Which Payment Roles are possible in TPH using Local Files?” post is not in a draft or unpublished mode on the https://tkc.temenos.com/ website?
    I tried to find the correct link to it, but it does not seem to exist. Can you please check the correct link URL for that post and let me know?

    It looks like that wordpress resurns the basic URL to it, which very likely means that the post is unpublished or drafted.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40771
    Peter Sippel
    Peter Sippel
    Participant

    Yes I’m sure, as the frontpage (tkc.temenos.com) only shows published items. And I have double checked. If you click on the listing item on the frontpage, you will get the correct link:

    https://tkc.temenos.com/generic/which-payment-roles-are-possible-in-tph-using-local-files/

    #40772
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, can you please add temporary back-end and FTP details?

    I can’t open the link, it requires a log-in. Thank you!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40779
    Peter Sippel
    Peter Sippel
    Participant
    You cannot access this content.
    #40784
    Peter Sippel
    Peter Sippel
    Participant
    You cannot access this content.
    #40790
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you!

    Can you please also add back-end access? I can’t open the links without logging in to the website, I am being redirected to a microsoft login page.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40791
    Peter Sippel
    Peter Sippel
    Participant
    You cannot access this content.
    #40808
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.