And for displaying result for Filter then try this code
add_filter( 'parse_query', 'prefix_parse_filter' );
function prefix_parse_filter($query) {
global $pagenow;
$current_page = isset( $_GET['post_type'] ) ? $_GET['post_type'] : '';
if ( is_admin() &&
'competition' == $current_page &&
'edit.php' == $pagenow &&
isset( $_GET['competition-name'] ) &&
$_GET['competition-name'] != '' ) {
$competition_name = $_GET['competition-name'];
$query->query_vars['meta_key'] = 'competition_name';
$query->query_vars['meta_value'] = $competition_name;
$query->query_vars['meta_compare'] = '=';
}
}
Change the meta key and meta value as required.
I have taken “competition name as meta_key and “competition-name” as select drop down name.
Related Posts:
- Media library – Limit images to custom post type
- How can I filter posts by post_parent in the admin?
- Filter by custom Field for Custom post type Admin Listing
- Unable to filter on field on edit.php page
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- How can I add a column in the wp_list_table of the admin area?
- Archive filter disappears on no results?
- Add html to cpt main page / admin edit.php
- How to add a post slug to a url?
- Filtering posts list table
- sortable columns for multiple custom post types not working
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Query filter by value in meta_value array
- Is there any filter to add a custom attribute to the tag in admin panel?
- Filter posts by their related field’s custom field
- Help Adding filter to Add Media button for custom post type
- Grouping and paging CPT events by month with custom field date
- Filter Content on all Post Types
- using ACF datepicker to filter posts on a page
- Collection of fields in a single post
- Filter page ID outside the loop and order
- How can I filter records in a custom post type list in the admin based on the ACF field in the post that contains the current user?
- How do I add a filter to my custom post type archive page?
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- Selecting a post in Dashboard
- filter custom post type by meta key in dashboard
- Custom admin post.php page
- Categories of custom taxonomy don’t show any posts
- A simple script to allow sorting of custom posts in admin?
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Notify admin on new submit
- Add custom ID to CPT posts only create not update
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- On update or create post redirect to current post position in list
- ACF Field on CPT Slug
- WordPress sort search results by custom order
- How to filter wp_list_categories output with some custom post type meta query?
- How to Filter custom post type by taxonomy?
- WP_Query order by custom field, then randomly order some of results
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Filter term taxonomy metabox in custom post type
- creat filter with wp_query
- Troubles with acf/save_post and WP_Query
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Query custom post type with ACF Date
- custom post type WYSIWG removes paragraphs when displayed
- Stuck in Order by more then one
- Custom Post Type + ACF and performance [closed]
- Meta Query Not Returning Output Despite Having Matching Values
- Options page – dropdown of users
- How can I made custom taxonomies relationship?
- ACF From & To Date Validations
- WooCommerce sort products by the actual product width(not the shipping width)
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to change the post type a theme shows by default?
- How to render a custom post type template with custom fields using shortcode
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- filter custom post in rest api with custom function
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- No Permission to add new Page, Post or CPT with Admin role
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- Order Custom Post Type by Custom Field Value
- Sort and filter custom post type posts by custom taxonomy
- Versioned Custom Post Type (Not the same as revisions)
- Retrieve custom field from Contact Form 7 [closed]
- Query Custom Post Type Taxonomy term with multiple parameters
- Admin Column does not populate with data
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- How to query WordPress posts bycustom field with a max characters’ length
- Loop filtering Custom Post Types and/or Categories
- search suggest – filter post type
- the_content filter on some post types only not working
- The loop seems stuck to a single (now deleted) post
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- CPT Validation to not show “Post updated.”
- How to update post meta on uploaded image from a custom form?
- Custom filter function not working with Custom post type
- How to group posts and get a mixed posts and groups view?
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Filter Posts from the Main Query
- Categories filtering in new post
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Multiple Frontend Filters Using Advanced Custom Fields
- How to use manage_$post_type_posts_columns with underscore in post type?
- Integrate Custom Post Type Events into Calendar
- How does the filter post_updated_messages work?
- Specific routing for CPT
- Search filter triggered & sort by custom post type
- How to order posts of a custom post type by date DESC in dashboard Admin?
- Order post by date with ACF
- Displaying custom field according to date
- How to set the seo title tag on a page by page basis?
- WebP Fallback for Inline Background Image in Style Attribute
- Adavnced custom fields relationship query plus query inside
- Query based on custom fields start and end date