Viewing 4 reply threads
  • Author
    • #3570

      I’ve created many custom post types for wordpress now with Piklist, but can somebody tell me how to get “tags” added to the backend display so I can use tags as a taxonomy. i have managed to get categories to display, but not tags

    • #3571

      @s1r0n– Showing tags is the same as showing categories. However, the real name of tags, is post_tag. Make sure you are using that.

    • #11134

      I’m having trouble with what I think is the same need: to have a custom post type use the same stock tags taxonomy used by standard posts.

      Based on the documentation I’ve read, it seems like I only need to include the tags taxonomy when I register the custom post type (see below). It doesn’t seem like I need to register the existing tags taxonomy (ie, using “piklist_taxonomies”) also, as that seems to create yet another tags taxonomy in addition to the stock tags taxonomy.

      However, when I register the custom post type with the tags taxonomy, CPT posts don’t appear under the stock tags taxonomy archive.

      // Resources via Piklist: Add resource custom post type.
      add_filter(‘piklist_post_types’, ‘lm_resource_post_type’);
      function lm_resource_post_type($post_types) {
      $post_types[‘resource’] = array(
      ‘labels’ => piklist(‘post_type_labels’, ‘Resource’)
      ,’title’ => __(‘Enter a new resource title’)
      ,’menu_icon’ => piklist(‘url’, ‘piklist’) . ‘/parts/img/piklist-menu-icon.svg’
      ,’page_icon’ => piklist(‘url’, ‘piklist’) . ‘/parts/img/piklist-page-icon-32.png’
      ,’supports’ => array(
      ,’public’ => true
      ,’admin_body_class’ => array(
      ,’has_archive’ => true
      ,’rewrite’ => array(
      ‘slug’ => ‘resources’
      ,’capability_type’ => ‘post’
      ,’edit_columns’ => array(
      ‘title’ => __(‘Resource’)
      ,’author’ => __(‘Contributed by’)
      ,’taxonomies’ => array(‘post_tag’)
      return $post_types;

    • #11135

      Sometimes that’s not enough for WordPress and you need to use register_taxonomy_for_object_type

      Here are the docs:

      This should work:

      function my_register_taxonomy_for_object_type() {
          register_taxonomy_for_object_type( 'post_tag', 'resource' );
      add_action( 'init', 'my_register_taxonomy_for_object_type' );
    • #11137

      Thanks @sbruner, that did the trick!

      I’ll also note if one wants different types of posts to show up together in various listings (like for authors, archives, etc), one has to make that happen with something like:

      add_filter( ‘pre_get_posts’, ‘lm_archive_author’ );
      function lm_archive_author( $query ) {
      if ( ( !is_admin() && $query->is_main_query() ) && ( is_front_page() || is_tax() || is_author() || is_archive() ) ) {
      $query->set( ‘post_type’, [‘resource’, ‘post’] );
      return $query;

Viewing 4 reply threads
  • The topic ‘adding tags to custom post types’ is closed to new replies.