Forums Forums Search & Filter Pro Post Type Not Working

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #4344

    The post type below is not working. It shows standard posts instead of the post type.

    add_action('init', 'cptui_register_my_cpt_images');
    function cptui_register_my_cpt_images() {
    register_post_type('images', array(
    'label' => 'Images',
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'map_meta_cap' => true,
    'hierarchical' => false,
    'rewrite' => array('slug' => 'images', 'with_front' => 1),
    'query_var' => true,
    'has_archive' => true,
    'menu_position' => '100',
    'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats'),
    'taxonomies' => array('category','post_tag'),
    'labels' => array (
      'name' => 'Images',
      'singular_name' => 'image',
      'menu_name' => 'Images',
      'add_new' => 'Add image',
      'add_new_item' => 'Add New image',
      'edit' => 'Edit',
      'edit_item' => 'Edit image',
      'new_item' => 'New image',
      'view' => 'View image',
      'view_item' => 'View image',
      'search_items' => 'Search Images',
      'not_found' => 'No Images Found',
      'not_found_in_trash' => 'No Images Found in Trash',
      'parent' => 'Parent image',
    )
    ) ); }
    Ross Moderator
    #4370

    Is this related to your other support ticket? Let me know and if not I’ll investigate further.

    Thanks

    Anonymous
    #4492

    No, this is another issue. Other post types work, but for some reason this one won’t work.

    Ross Moderator
    #4548

    It sounds like either the post type is registered after the search, or it could be some conflict with a post type called images.

    Could you try using the same code, but give the post type a different (and unique) name?

    Failing that you could try adding a lower/higher priority to your init action:

    add_action('init', 'cptui_register_my_cpt_images', 1);

    Let me know if any of the above works.

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)