How to filter custom post types by custom category taxonomy

You are doing a little mistake in your $pargs As per documentation Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). Also you have “post_per_page” instead of “posts_per_page” $pargs = array( ‘posts_per_page’ => ‘-1’, ‘post_type’ => ‘products’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, … Read more

Remove Trash / Delete option for Custom Post Type / Taxonomy

Try these: /** * Removes the “Trash” link on the individual post’s “actions” row on the posts * edit page. */ add_filter( ‘post_row_actions’, ‘remove_row_actions_post’, 10, 2 ); function remove_row_actions_post( $actions, $post ) { if( $post->post_type === ‘prj’ ) { unset( $actions[‘clone’] ); unset( $actions[‘trash’] ); } return $actions; } add_action(‘wp_trash_post’, ‘restrict_post_deletion’); function restrict_post_deletion($post_id) { if( … Read more

RSS Feed for posts containing any term from a taxonomy

The Solution WordPress 3.1 Taxonomy Feeds Plugin (Must Use) Put that must-use plugin on your site and request: http://blog.example.com/feed/?taxonomy=taxonomy-name as you asked for it. Detailed Information WordPress offers requesting the feed with multiple configurations. Finding Your Feed URL (WordPress Codex) shows what is possible. Next to the standard feed (posts) you can have the following: … Read more

How do you remove a Category-style (hierarchical) taxonomy metabox?

Non-hierarchical taxonomies (like tags) use tagsdiv-{$tax_name}. Hierarchical taxonomies (like categories) use {$tax_name}div. This is for historical reasons: categories were placed in categorydiv, tags in tagsdiv. When support for multiple non-hierarchical taxonomies was added, the tagsdiv name was expanded to tagsdiv-{$tax_name}. When finally multiple hierarchical taxonomies were made possible, they choose to generalize categorydiv to {$tax_name}div.

Get terms that contain posts that in turn belong to other terms?

This should get you the names of all such terms in an array $wpdb->get_col(“SELECT DISTINCT {$wpdb->terms}.name FROM {$wpdb->terms} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id INNER JOIN {$wpdb->term_relationships} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘shape’ AND {$wpdb->term_relationships}.object_id IN ( SELECT object_id FROM {$wpdb->term_relationships} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘color’ … Read more

How to display warning on post editor when trying to add new term to custom taxonomy?

Whilst this doesn’t show a warning as you are asking for, you could always hide the “add new” link using the admin_head action: function yourprefix_admin_head() { echo ‘<style> #language-add-toggle { display: none; } </style>’; } add_action(‘admin_head’, ‘yourprefix_admin_head’); The element ID is the taxonomy name followed by -add-toggle. This is enough for most cases, unless you … Read more