remidk
Forum Replies Created
-
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Custom search.php resultsI tried something like that :
add_filter( 'relevanssi_hits_to_show', 'rlv_hits_filter' );
function rlv_hits_filter( array $hits ) : array {
$kept_posts = array();
foreach ( $hits[0] as $_post ) {
$kept_posts[] = $_post;
}
print_r($kept_posts);
$hits[0] = $kept_posts;
return $hits;
}And it looks like we have some results :
5112024-07-29 17:56:332024-07-29 15:56:33[recette_infos][recette_details][searchform post_types="recettes"]testpublishclosedclosedtest2024-08-22 17:12:572024-08-22 15:12:570https://localhost/wordpress/wordpress/?post_type=recettes&p=510recettes0raw6Array ( [0] => 51 [1] => 1 [2] => 2024-07-29 17:56:33 [3] => 2024-07-29 15:56:33 [4] => [recette_infos][recette_details][searchform post_types="recettes"] [5] => test [6] => [7] => publish [8] => closed [9] => closed [10] => [11] => test [12] => [13] => [14] => 2024-08-22 17:12:57 [15] => 2024-08-22 15:12:57 [16] => [17] => 0 [18] => https://localhost/wordpress/wordpress/?post_type=recettes&p=51 [19] => 0 [20] => recettes [21] => [22] => 0 [23] => raw [24] => 6 )
I will try to check my child theme. Thanks for your help ! ??
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Custom search.php results$query->posts
is always empty. If I try to print inrelevanssi_hits_filter
, I have this :Array ( [0] => WP_Post Object ( [ID] => 187 [post_author] => 1 [post_date] => 2024-08-22 09:45:13 [post_date_gmt] => 2024-08-22 07:45:13 [post_content] => [post_title] => fromage [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => fromage [to_ping] => [pinged] => [post_modified] => 2024-08-22 09:45:14 [post_modified_gmt] => 2024-08-22 07:45:14 [post_content_filtered] => [post_parent] => 0 [guid] => https://localhost/wordpress/wordpress/?post_type=recettes&p=187 [menu_order] => 0 [post_type] => recettes [post_mime_type] => [comment_count] => 0 [filter] => raw [relevance_score] => 5 ) [1] => WP_Post Object ( [ID] => 130 [post_author] => 1 [post_date] => 2024-08-02 14:26:06 [post_date_gmt] => 2024-08-02 12:26:06 [post_content] => [post_title] => [test] fromage vegan [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => test-fromage-vegan [to_ping] => [pinged] => [post_modified] => 2024-08-02 14:26:06 [post_modified_gmt] => 2024-08-02 12:26:06 [post_content_filtered] => [post_parent] => 0 [guid] => https://localhost/wordpress/wordpress/?post_type=recettes&p=130 [menu_order] => 0 [post_type] => recettes [post_mime_type] => [comment_count] => 0 [filter] => raw [relevance_score] => 5 ) [2] => WP_Post Object ( [ID] => 51 [post_author] => 1 [post_date] => 2024-07-29 17:56:33 [post_date_gmt] => 2024-07-29 15:56:33 [post_content] => [recette_infos][recette_details][searchform post_types="recettes"] [post_title] => test [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => test [to_ping] => [pinged] => [post_modified] => 2024-08-22 17:12:57 [post_modified_gmt] => 2024-08-22 15:12:57 [post_content_filtered] => [post_parent] => 0 [guid] => https://localhost/wordpress/wordpress/?post_type=recettes&p=51 [menu_order] => 0 [post_type] => recettes [post_mime_type] => [comment_count] => 0 [filter] => raw [relevance_score] => 2 ) ) Array ( )
I didn’t find
relevanssi_hits_to_show
in the documentation. Do you have a link to this one ?Forum: Plugins
In reply to: [Relevanssi - A Better Search] Custom search.php resultsI tried and it works well
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Custom search.php resultsI’m using a new
WP_query
. Here the code :$query_args = array(
'post_type' => array('recette'),
's' => $s,
'posts_per_page' => 15,
'relevanssi' => true
);
$query = new WP_query( $query_args );And for testing :
if ( $query->have_posts() ) {
echo $query->found_posts;
while ( $query->have_posts() ) {
$query->the_post();
?>
<h2>Display test</h2>
<?php
}
wp_reset_query();
}I also tried with
relevanssi_do_query( $query );
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Error with Divi and filtersThanks for your help ! I will ask to Divi. If they give me a solution, I can post it here if you want. It could help someone.
@missveronicatv thanks for your answer. If I understand, because of the format, Ultimate Member thinks the login is an email ? It could explain why it doesn’t work, but I don’t understand why 95% of the users can connect and 5% can’t. Everyone use a mail address as login. I’ll try to check the request when I come back to work. Maybe it can help ??
@missveronicatv username and password
@missveronicatv for example someone has “[email protected]” for user_login and his personal email for email. With his personal email its works but not with his user_login. If I try exactly the same but with my email address for user_login, it works
@missveronicatv thanks for your answer ! Yes @ and . they used email addresses. But many other users did the same thing and don’t have this issue. Do you think that could still be the problem ?