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 1 year, 3 months ago.
- AuthorPosts
- January 3, 2023 at 5:24 pm #40722
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=1Prod (not working):
https://tkc.temenos.com/?post_type=generic&p=8414&asp_highlight=acw&p_asid=3I’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
PeterJanuary 4, 2023 at 2:13 pm #40744Hi 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 :)
January 4, 2023 at 4:05 pm #40751Hi 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
PeterJanuary 4, 2023 at 4:35 pm #40752Is 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 :)
January 4, 2023 at 9:42 pm #40759Hi 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
PeterAttachments:
You must be logged in to view attached files.January 5, 2023 at 1:19 pm #40770Okay.
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 :)
January 5, 2023 at 1:29 pm #40771Yes 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/
January 5, 2023 at 1:33 pm #40772Okay, 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 :)
January 5, 2023 at 2:39 pm #40779You cannot access this content.January 5, 2023 at 2:58 pm #40784You cannot access this content.January 5, 2023 at 4:20 pm #40790Thank 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 :)
January 5, 2023 at 4:35 pm #40791You cannot access this content.January 7, 2023 at 1:43 pm #40808You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.