Why is my WP_Query not working when tax_query terms are an array?

When you’re doing a tax_query or meta_query in a WP_Query, you always have to use a nested array( array() ); just see the following example for an explanation and pay attention to the relation argument. $packages = new WP_Query( array( ‘post_type’ => ‘vamos-cpt-packages’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘vamos-holiday-types’, ‘field’ => … Read more

Get all terms inside a specific taxonomy in a multisite

No way to do that in a “word press” way… function multisite_profession_select(){ switch_to_blog(1); $taxonomies = array(‘rsitecat’); $check_later = array(); global $wp_taxonomies; foreach($taxonomies as $taxonomy){ if (isset($wp_taxonomies[$taxonomy])){ $check_later[$taxonomy] = false; } else { $wp_taxonomies[$taxonomy] = true; $check_later[$taxonomy] = true; } } $args = array(‘hide_empty’ => false); $terms = get_terms($taxonomies, $args ); echo ‘<pre>’; print_r($terms); echo ‘</pre>’; … Read more

Retrieve single term slug

Thank you guys for such quick response. Much appreciated! Here is code for “global” Tags page (displaying terms of default ‘post_tag’ taxonomy): <?php $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $loop = new WP_Query( array( ‘post_type’ => ‘any’, ‘tag’ => $term_slug, ‘posts_per_page’ => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> … Read more

Child Terms not Displaying on the Taxonomy Term Admin Screen

I’ve encountered this kind of problem when i was building some front end post / term creation form. The number oh the ‘Right Now’ dashboard shows the right number of term, but the new term doesn’t shows up in the taxonomy admin screen. The solution: delete_option(‘taxonomy-name_children’); where ‘taxonomy-name’ is the name of the taxonomy. Hope … Read more

Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children

This seems to be normal, it also happens for categories. The wp_terms_checklist(), which creates the checklist, has an argument checked_ontop, enabled by default. The metabox does not override this, so checked categories or custom terms always appear on top of the list. This does not affect their actual hierarchy, only how they are displayed there. … Read more

Using 1 taxonomy for multiple post types?

You can use an array of post types in register_taxonomy() $object_type (array/string) (required) Name of the object type for the taxonomy object. Object-types can be built-in Post Type or any Custom Post Type that may be registered. http://codex.wordpress.org/Function_Reference/register_taxonomy Example: register_taxonomy( ‘artist’, array( ‘profile’, ‘cd’ ), $args );

Remove quick edit for custom post type

Check out the builk actions page in the codex. I believe the proper action to unset is inline. This will remove the “Edit” bulk action, which is actually quick edit. <?php function remove_bulk_actions( $actions ){ unset( $actions[‘inline’] ); return $actions; } add_filter(‘bulk_actions-custom_post_type_slug’,’remove_bulk_actions’); ?> As for the Quick edit in each row, look into manage_{$post_type}_columns, as … Read more