Support » How-To and Troubleshooting » Tag Cloud & Custom Post Types

Tag Cloud & Custom Post Types

  • I am currently creating a portal type website. We have created several custom post types such as wiki, and project which each have their own taxonomies, but they also include the WordPress post_tags, and such. Running the default WordPress tag cloud yields the correct count when hovering over a tag (for example it says 3 posts of category QOTC) however, once you click on it you receive a page where nothing is found unless the category was linked to a post. I have searched through the default-widget.php file and the post-template.php file to no avail. Does anyone know how to make the custom post types display on the output page for the tag cloud? Thanks in advanced.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have the same problem. The links of regular tags doesnt work with Custom Post Types.

    With the regular categories I had the same. But I corrected with code below (in functions.php)

    function any_ptype_on_cat($request) {
    	if ( isset($request['category_name']) )
    		$request['post_type'] = 'any';
    	return $request;
    add_filter('request', 'any_ptype_on_cat');

    I created my custom post types built-in categories and tags.

    I solve with this:

    function any_ptype_on_tag($request) {
    	if ( isset($request['tag']) )
    		$request['post_type'] = 'any';
    	return $request;
    add_filter('request', 'any_ptype_on_tag');

    An adaptation of the code above.

    Original Credits:

    Thank you very much for your help, it worked perfectly. And for anyone else who needs this information, paste the above codes into the bottom of the functions.php file and it will work. Another one I would add is the following as sometimes the request is category_name and other times it is simply cat. But otherwise it is perfect.

    function any_ptype_on_cate($request) {
    	if ( isset($request['cat']) )
    		$request['post_type'] = 'any';
    	return $request;
    add_filter('request', 'any_ptype_on_cate');

    Thanks a lot .

    Thank you both raquel_p and luckoskij

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tag Cloud & Custom Post Types’ is closed to new replies.
Skip to toolbar