Support » Plugin: WP SEO Structured Data Schema » How to apply on custom post types.

  • Hello Phil Singleton,
    I have implement your extension but now schema options available only on page and post types only.
    How we can implement on selected extra post types?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • hi,
    an appropriate question for a really important feature, it’s implemented and configurable ?

    thanks

    Unfortunately that’s not possible yet. Will there be an update for that soon? Thanks a lot in advance.

    For the time being this can be done by removing the restriction to standard post types in the plugin file KcSeoHelper.php

    
    function kcSeoPostTypes() {
      $post_types = get_post_types(
      //  array(
      //    '_builtin' => true
      //  )
      );
      $exclude    = array( 'attachment', 'revision', 'nav_menu_item' );
      foreach ( $exclude as $ex ) {
        unset( $post_types[ $ex ] );
      }
    
      return $post_types;
    }
    

    Hi Phil Singleton,

    I have added a filter, so I can flexibly adjust the post-types without the plugin integrating automatically into all post-types.

    Maybe you can take the filter to the next release.

    function kcSeoPostTypes() {
    	$post_types = get_post_types(
    		array(
    			'_builtin' => true
    		)
    	);
    	$exclude    = array( 'attachment', 'revision', 'nav_menu_item' );
    	foreach ( $exclude as $ex ) {
    		unset( $post_types[ $ex ] );
    	}
    
    	return apply_filters('kc_post_types', $post_types);
    }
    

    and in the functions.php of the child-theme:

    function ae_changed_kc_post_types ($post_types) {
    	$post_types['portfolio']="portfolio";
    	return $post_types;
    }
    add_filter ('kc_post_types', 'ae_changed_kc_post_types');
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to apply on custom post types.’ is closed to new replies.