How to get_queried_object on multiple objects?

You almost had it with $_GET[‘zap_audience’], but not quite, since it isn’t passed in as a GET variable. It is however a query variable, so try these: $post_type = get_query_var( ‘post_type’ ); $audience = get_query_var( ‘zap_audience’ ); $city = get_query_var( ‘zap_cities’ ); Also +1 for prefixing your taxonomy types with zap_

Make the ‘all’ filter default instead of ‘mine’ in a custom post type

answer ^^ add_action( ‘load-edit.php’, function() { global $typenow; // Not our post type, bail out if( ‘community’ !== $typenow ) return; // Administrator users don’t need this, bail out if( current_user_can(‘add_users’) ) return; // Only the Mine tab fills this conditions, redirect if( !isset( $_GET[‘post_status’] ) && !isset( $_GET[‘all_posts’] ) ) { wp_redirect( admin_url(‘edit.php?post_type=community&all_posts=1’) ); … Read more

Add pre-existing meta box to new custom post type

This depends on how your parent theme hooks in the meta_boxes. If the callbacks are hooked to add_meta_boxes and written similar to the following from the Codex: function myplugin_add_meta_box() { $screens = array( ‘post’, ‘page’ ); foreach ( $screens as $screen ) { add_meta_box( ‘myplugin_sectionid’, __( ‘My Post Section Title’, ‘myplugin_textdomain’ ), ‘myplugin_meta_box_callback’, $screen ); … Read more

Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?

I’d figure, it mainly is not advised, because it is intended just to use it for built-in post types, just because you can use for custom post types it does not change anything on that intention. For example, if you use it and there are changes in WordPress that make that arguments use strictly available … Read more

Secondary loop pagination on custom post type single post gets redirected to first page

I found the answer. I had searched high and low yesterday, but today I finally found it: https://wordpress.stackexchange.com/a/143837/10595 add_action(‘template_redirect’, function() { if ( is_singular(‘posttype’) ) { global $wp_query; $page = (int) $wp_query->get(‘page’); if ( $page > 1 ) { // convert ‘page’ to ‘paged’ $query->set( ‘page’, 1 ); $query->set( ‘paged’, $page ); } // prevent … Read more

I have a CPT that have menu_order enabled, how can I make the menu_order values unique so it won’t have duplicates

You can interfere with save_post action then change menu_order to post_ID: add_action(‘save_post’, function($post_id, $post, $update) { if ($post->menu_order === $post_id) { return $post_id; } else { global $wpdb; $q = “UPDATE $wpdb->posts SET menu_order=%d WHERE ID=%d”; $wpdb->query( $wpdb->prepare($q, [$post_id, $post_id]) ); return $post_id; } }, 9, 3);