Ok, so I think you could apply the codex example as is:
function search_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set('post_type', array( 'post', 'actualizacion', 'notificacion' ) );
}
}
}
add_action('pre_get_posts','search_filter');
I think you were just missing the !is_admin()
check in there…
Hope this helps!
Related Posts:
- Set posts of a custom post type to be private by default?
- How can I add dropdown widget/box to admin post page?
- Limit Authors to their Own Posts on front-end excluding admins
- Multiple Content Block
- Notice: Undefined index: suppress_filters
- Shortcode not working with post counter
- Changing default ‘posts’ parameters with register_post_type_args
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Allow users to create posts without logging in?
- How to assign classes to all elements?
- Showing custom post type categories in the menu
- WordPress notification if new post published
- Get post format
- Template code to split a post and print a custom field?
- Send post changes to set email addresses (not users or subscribers)
- Display author box on just certain category posts?
- redirect after submiting post for review
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- subtracting the current post form then whole loop, which is generating all CPT titles
- When post is Published, insert into custom table a number – custom post type
- Post that populates itself (almost) automatically using data from imported excel file
- How to mark posts as visited
- Featured image in custom post is being disabled
- How to make a non-public post on wordpress approval?
- Insert HTML inside link in a walker
- right_now_content_table_end function not working?
- WooCommerce product search titles only
- How to Separate CPT From Regular Posts?
- Remove rows in the manage post/page view
- Custom Taxonomy Permalinks Redirection
- Add custom column in custom post type edit page
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- How to create custom boxes with text inside?
- How to add post_type=value when editing that post type in the WordPress admin?
- wp_insert_post generates endless posts
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Remove standard meta boxes from custom taxonomy
- Open Custom Post Type as PDF
- Using The REST API How To Pull All Custom Posts?
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- What’s the difference between same wp functions get_posts(); functions in different form?
- I did group my search results by post type, but how can i give each of them its own order?
- Dequeue scripts and styles only for specific custom post type
- Function to display custom post type on front page makes menu items dissapear
- custom post type not showing in menu
- Show the same Article Available in Other Categories
- Getting posts under the custom post type ui category
- Show category ID on custom post type
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class
- How to customize a permalink (URL) structure?
- Display only one post each WEEK
- Custom Post Type with Templates using Meta Boxes?
- List children on child post
- Can I list a custom post type within another custom post type in the admin area?
- Restrict custom post type from appearing with ?post_types=
- Change custom post type slug from plugin options
- Show custom post type filtered by category
- create parent post using wp_insert_post
- Turn on and off custom post type from admin?
- Missing Posts in Custom Taxonomy List
- Display random posts, but omit the post it is on?
- How do I do this with WordPress? Taxonomies?
- Disable block with taxonomies at post page
- I would like to have different styles for my posts based on the content of each post
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- Showing posts from different categories and from custom post type
- Get latest 3 posts from multiple CPT in one query
- Can’t edit custom post type
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Which post does a taxonomy term belongs to?
- List custom taxonomy specific to one custom post type
- Post image in WordPress not appearing on home page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Meta query for custom post type ignored in main query
- Changing custom type name hides the posts
- Set URL link to featured image of custom post type
- Display Ad on Specific Categories
- Change CPT archive title
- AJAX load more for different custom post type loops
- Hiding posts by other users and non-logged in
- PHP variable not regenerating when publishing multiple posts at the same time
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- Update Post Meta for a logged in user
- Add custom field to Posts and sort by it
- Add custom post type settings to wordress default posts
- How to target a specific custom post type post and its all children and grandchildren?
- Featured image overlay when changing post status
- Get related posts of child term of custom post type
- Two Custom Post Types Many to Many Relationship
- Problem with displaying posts in the CPT category
- get_post_meta not working on publishing
- JS innerhtml changing style when using AJAX
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- ACF field key/value to show on taxonomy list
- Re-registering a custom post type not working (not showing up)
- Display featured image from one CPT within another CPT query
- Show titles, date of all posts on single category page