Recent issue with Simple Tags for WordPress

Simple Tags is a great plugin allowing you to bulk edit tags for Posts and Pages. I’ve used it before but never realized one of it’s short comings. I’m not the only one that found this one out. Simple Tags works great, but only for Posts and Pages, not custom post types.

Here’s what I did to fix the problem:

Find this section of code in inc/class.client.php and update with your “Custome-Post-Type” as shown below.


function registerTagsForPage() {
		register_taxonomy_for_object_type( 'post_tag', 'Custome-Post-Type', 'page' );
	}

	/**
	 * Add page post type during the query
	 *
	 * @param object $query
	 * @return void
	 * @author Amaury Balmer
	 */
	function includePagePostType( $query ) {
		if ( $query->is_tag == true ) {
			if ( !isset($query->query_vars['post_type']) || $query->query_vars['post_type'] == 'post' ) {
				$query->query_vars['post_type'] = array('post', 'page', 'Custome-Post-Type');
			} elseif( isset($query->query_vars['post_type']) && is_array($query->query_vars['post_type']) ) {
				$query->query_vars['post_type'][] = 'page';
			}
		}
	}

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.