What is the best way to ignore wordpress administration using add_filter($title) also when Ajax request

There are a couple of things here that should always be kept in-mind when you’re thinking of administrators and WordPress is_admin(). is_admin() tells you only whether or not the current WordPress request has been sent to the WP admin backend. This also, actually, include admin-ajax.php requests. It doesn’t tell you whether or not the current … 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

If/else statement for specific WordPress page title

You can determine whether the blog is displayed using is_home(): <?php if ( is_home() ) { echo ‘Blog’; } else { the_title(); } ?> Be aware that the the_title() function only displays the title of the current post. If you’re on any other kind of page, such as the blog, a category archive, a date … Read more