We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any possibility of filtering based on status? It would be nice to eliminate drafts in my current use case. Thanks!
The text was updated successfully, but these errors were encountered:
Sure, you could mimic what the plugin is doing w/ the post-types:
/** * Hook into pre_get_posts if we're doing a cmb2_post_search ajax request. */ function cmb2_post_search_check_if_ajax_post_search() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['cmb2_post_search'], $_POST['action'] ) && 'find_posts' == $_POST['action'] ) { add_action( 'pre_get_posts', 'cmb2_post_search_set_post_status' ); } } add_action( 'admin_init', 'cmb2_post_search_check_if_ajax_post_search' ); /** * Set the post status via pre_get_posts * @param array $query The query instance */ function cmb2_post_search_set_post_status( $query ) { $query->set( 'post_status', 'publish' ); }
Sorry, something went wrong.
Justin - this is great. Thank you!
👍
No branches or pull requests
Any possibility of filtering based on status? It would be nice to eliminate drafts in my current use case. Thanks!
The text was updated successfully, but these errors were encountered: