Exclude multiple custom post types from search

This is because elseif doesn’t work the way you think it does. You’re trying to use it in a way that’s closer to a switch statement or multiple if statement` This: if (post_type_exists(‘videos’)) { // exclude from search results $wp_post_types[‘videos’]->exclude_from_search = true; } elseif (post_type_exists(‘coordinator’)) { // exclude from search results $wp_post_types[‘coordinator’]->exclude_from_search = true; } … Read more

Exclude in search post and include only 3 pages

you’re using $query->set(‘post_type’, ‘post’); to only include posts. What you can do is make it an array to include the post type and those specific page IDs you want. Here’s an example code: function custom_search_filter($query) { if ($query->is_search() && !is_admin() && $query->is_main_query()) { $query->set(‘post_type’, ‘post’); // Add the IDs of the pages you want to … Read more

Google indexing pages that are not used

You should enter the editor of your pages, and as you see for example here, on the right side settings you can control their “visibility”. Change that to “private”, and then Google won’t see them. Once Google will reindex your pages, these should disappear from its search results. And until then, visitors will see a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)