Support

Account

Forum Replies Created

  • Thanks a lot @jarvis for your time and patience, I really appreciate it!
    Your code is working perfectly, and no more critical error for me! I’m very happy to continue building my website now 🙂

    My menu disappeared though, but I found a solution here by using a $query->is_main_query() if anyone has the same problem.

  • Thank you for your inputs, unfortunately it’s not working either…
    I also tried to change the function’s name, no luck.
    If I comment add_action('pre_get_posts', 'my_pre_get_posts'); it’s working, but it doesn’t use the function ;;

  • Yes, if I remove the function below I don’t have any error :

    add_action('pre_get_posts', 'my_pre_get_posts'); 
    function my_pre_get_posts( $query ) {
    
    	$meta_query = $query->get('meta_query');
    	
    	if( isset($_GET['coup_de_coeur']) )
    	{
    		$meta_query[] = array(
    			'key' => 'coup_de_coeur',
    			'value' => $_GET['coup_de_coeur'],
    			'compare' => 'LIKE',
    		);
    	}
    	$query->set('meta_query', $meta_query);
    	return;
    
    }
    

    I checked and it seems like everything is correctly closed, no comma missing…
    Unfortunatelu the critical error doesn’t provide any line of code so I’m a bit in the dark…
    I tried to put WP Debug to true but no luck either.

  • Wow, thank you for your quick answer jarvis!
    I changed the “=” to LIKE but it still doesn’t work unfortunately, still critical error.

    For information, I placed this function in the functions.php of my child theme

  • Hi Jarvis,

    Thank you for taking the time to answer my question.
    The support helped me too, it was because of a name conflict…

    Have a nice day!

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