Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Error 500 with AjaxSearchPro Plugin
- This topic has 11 replies, 2 voices, and was last updated 1 year, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
February 6, 2025 at 4:55 pm #52779
alicia
ParticipantDear AjaxSearchPro Support Team,
I am experiencing an issue with the AjaxSearchPro plugin on my website. When performing any search using the search bar created with this plugin, I encounter the following error message:
“The request failed. Please check your connection! Status: 500.”
This issue occurs consistently every time I attempt a search.
Could you please assist me in resolving this error? I would appreciate any guidance or troubleshooting steps you can provide.
Thank you for your time and support.
Best regards,
AlíciaFebruary 7, 2025 at 10:12 am #52788Ernest Marcinko
KeymasterHi Alícia,
Thank you very much for the details, it helps a lot!
I tried to log-in to check the settings, but the username or password is incorrect. Can you please check that?
It’s probably something in the configuration, I will verify that for you.February 7, 2025 at 10:41 am #52792alicia
ParticipantYou cannot access this content.
February 7, 2025 at 11:32 am #52793Ernest Marcinko
KeymasterThank you Alícia, my mistake!
The settings seem to be all right. Do you use any customizations, custom codes or anything related to Ajax Search Pro by any chance? I’m asking because even empty requests return an error, which usually happens when there is an issue with a customization.
If not, then can you please add temporary SFTP details? I will have to debug through the search process to see where it fails, there is probably an error message which will lead to the solution.
February 10, 2025 at 9:06 am #52833alicia
ParticipantYou cannot access this content.
February 10, 2025 at 9:50 am #52834Ernest Marcinko
KeymasterHi Alícia,
Does the issue go away if the customization is removed?
February 10, 2025 at 10:03 am #52844alicia
ParticipantHi Ernest,
I’ve already tried removing the customization, but the issue persists and the error is still appearing.
Please let me know the next steps to resolve this.
Thank you for your continued support.
Best regards,
AlíciaFebruary 10, 2025 at 10:04 am #52845Ernest Marcinko
KeymasterThank you!
Can you please add temporary SFTP details? I will have to debug through the search process to see where it fails, there is probably an error message which will lead to the solution.
February 10, 2025 at 10:13 am #52860alicia
ParticipantYou cannot access this content.
February 10, 2025 at 12:27 pm #52885Ernest Marcinko
KeymasterThanks!
The issue is caused by the custom code as it uses the “yoast_get_primary_term_id” function, but the Yoast SEO plugin is disabled, so that no longer exists. I made a modification to it to check if the function exists first:
add_filter( 'asp_results', function ( $results, $id, $is_ajax, $args ) { foreach ( $results as $r ) { if ( function_exists('yoast_get_primary_term_id') ) { // Intenta obtenir la categoria principal amb Yoast $main_term_id = yoast_get_primary_term_id( 'category', $r->id ); } else { $main_term_id = false; } // Si no hi ha categoria principal, obtenim la primera categoria disponible if ( empty($main_term_id) ) { $terms = get_the_terms( $r->id, 'category' ); if ( !empty($terms) && !is_wp_error($terms) ) { // Prenem la primera categoria disponible $term = reset($terms); } else { continue; } } else { // Si hi ha categoria principal, la utilitzem $term = get_term( $main_term_id ); if ( empty($term) ) { continue; } } // Afegeix la categoria als resultats $r->content = '<div class="result-cat-container"><span class="result-cat">'.$term->name.'</span></div>' . $r->content; } return $results; }, 10, 4 );February 10, 2025 at 1:51 pm #52889alicia
ParticipantHi Ernest,
Thank you so much for your help and for identifying the issue.
I must apologize – it seems I didn’t test thoroughly before. Had I commented out the code, I would have noticed that the search was working fine. I appreciate your patience and the fix you made to the code.
Thank you again for your prompt support and for resolving the issue!
Best regards,
AlíciaFebruary 10, 2025 at 1:51 pm #52890Ernest Marcinko
KeymasterYou are very welcome Alícia 🙂 No worries!
-
AuthorPosts
- You must be logged in to reply to this topic.