1

I've got the following error messages on the themecheck plugin in my WordPress theme.

REQUIRED: The theme uses the register_taxonomy() function, which is plugin-territory functionality.
REQUIRED: The theme uses the register_post_type() function, which is plugin-territory functionality.
WARNING: The theme uses the add_shortcode() function. Custom post-content shortcodes are plugin-territory functionality.

I declared the register_taxonomy() and register_post_type() function in after_setup_theme hook.
My register_taxonomy() function is:

register_taxonomy('project_cat', 'project', array(
    'public'        => true,
    'hierarchical'  => true,
    'labels'        => array(
        'name'  => 'Categories',
    )
));

And one of my register_post_type() function is:

register_post_type('service', array(
    'public'    => true,
    'supports'  => array('title', 'thumbnail', 'editor'),
    'labels'    => array(
        'name'          => esc_html__('Services', 'textdomain'),
        'add_new_item'  => esc_html__('Add Service', 'textdomain'),
        'add_new'       => esc_html__('Add Service', 'textdomain')
    )
));

How can I fix those issues?

  • The messages are pretty clear. What exactly is your problem? – fuxia Mar 5 '16 at 1:11
2

Registering custom posts is a plugin territory. It means that you need to remove them from the theme's functionality and register them via a plugin (usually recommended when installing the theme using TGM Plugin Activation or something else). Here are the recommendations of the Theme Review Team.

Themes must not incorporate the following, Plugin-territory functionality. This list is not all-inclusive.

  • Analytics scripts
  • SEO options (meta tags, page title, post titles, robots.txt, etc.)
  • Content Sharing buttons/links
  • Custom post-content shortcodes
  • Custom Post Types
  • Custom Taxonomies
  • Removing or modifying non-presentational core hooks
  • Disabling the admin toolbar
  • Resource compression/caching
4

You should reread the error messages. Custom taxonomies, custom post types and shortcodes should not be registered in a theme, that should be standard practice. Custom taxonomies, custom post types and shortcodes shoule be registered in a plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.