• If some body uses custom post types and wants to get Meta SEO Pack to work with those types I have made small hack. This hack adds meta box for all post types that have capability_type value set to ‘post’ or ‘page’ including built in and all custom post types that have user created.

    Meta SEO pack version: 2.2.1 (Last Updated: 2010-3-17)

    • Open file “meta-seo-pack/meta-seo-pack.php” (you can also use plugin editor inside WordPress).
    • Goto line 211 or near that, and find lines:
      add_meta_box( 'msp_sectionid', 'Meta SEO Pack', array( &$this, 'post_metabox' ), 'post', 'normal', 'high' );
      add_meta_box( 'msp_sectionid', 'Meta SEO Pack', array( &$this, 'post_metabox' ), 'page', 'normal', 'high' );
    • Comment those lines using // or delete them
    • After these lines insert new code:
      // This will also support all custom post types not only built in
      $capability_types=array('page','post');
      foreach ($capability_types as $capability_type ) {
      	$post_types=get_post_types(array('capability_type'=>$capability_type),'names');
      	foreach ($post_types as $post_type ) {
      		add_meta_box( 'msp_sectionid', 'Meta SEO Pack', array( &$this, 'post_metabox' ), $post_type, 'normal', 'high' );
      	}
      }

    This code works for me, hope somebody will find this useful to.

    https://www.ads-software.com/extend/plugins/meta-seo-pack/

Viewing 5 replies - 1 through 5 (of 5 total)
  • What if Meta SEO Pack is updated? (I know it hasn’t been in over 2 years). Could this be placed in the functions.php file of a theme and still work?

    Noticed one thing. I use the Advanced Custom Fields (ACF) plugin. After enabling Meta SEO Pack for custom post types (with your code), the custom fields created by ACF appear, but the content is missing. Any thoughts?

    ACF Plugin Link:
    https://www.ads-software.com/extend/plugins/advanced-custom-fields/

    Thread Starter Vytas M.

    (@vytasm)

    If it will be updated some day maybe it will include this fix to have possibility add information to all post types.

    About the ACF plugin I do not use it so do not know what to tel. Have you tried to disable my code and checked if ACF works? Check not only on your custom posts but also on normal posts and pages. Does it work or not? By the way what WP version do you use?

    I’m using WP 3.4.1

    If I remove your code from the Meta SEO plugin, the custom fields display their content.

    Another strange occurrence: the content of a custom field shows on a regular page, until I drag the Meta SEO content area below the custom field content area to reorder the content boxes (native WP drag-and-drop interface). If I refresh the page (after the re-order), the content appears. If I Update the page or leave the edit page, then come back, the custom fields and Meta SEO Plugin fields show up.

    I Updated and refreshed both a regular page and a custom post type page, and it appears that the Meta SEO Plugin is now working.

    Scared me for a minute when the content disappeared! ??

    I like your addition very much! Is there a way to add your code to a functions.php file? Thanks!

    Thread Starter Vytas M.

    (@vytasm)

    Good to hear that somebody has found this patch useful. About disappearing text I do not know very much because I didn’t created this plugin. That peace of code that I have added just lists all post types that are identified as post or page. When you are creating custom post type you set how this post type treats. When you register new post type you set capability_type like https://codex.www.ads-software.com/Function_Reference/register_post_type That code just finds all custom posts that have capability_type set to ‘page’ or ‘post’ and adds Meta SEO Plugin to it. So it was quite interesting that custom field content disappeared to you.

    About adding it to functions.php I can will try later to check one idea that i have just in my head. maybe it will work. If it will be successful I will post solution here.

    The custom field content did show up, but only after I refreshed the page or revisited it.

    Maybe there’s some kind of refresh that the Meta SEO Pack should do when content blocks are re-arranged on a page or post?

    Your addition does work (only with minor bugs that may not be directly related), so thank you! I look forward to being able to add this to the functions.php file. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Meta SEO Pack] Add meta box to custom post types’ is closed to new replies.