WordPress.org

Ready to get started?Download WordPress

Forums

CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] plugin conflict with add_action('add_meta_boxes') (2 posts)

  1. JuniperPaul
    Member
    Posted 1 year ago #

    CPT-onomies version 1.2.1

    Rachel, I'm wanting to use your superb cpt-onomies plugin in combination with another plugin (WCK Post Type Creator by Madalin Ungureanu) that creates admin meta boxes, and I'm finding that the method of hooking into WordPress that he's using appears to conflict with the one you're using.

    I'm seeing this error message:

    Warning: Missing argument 2 for CPT_ONOMIES_ADMIN::add_cpt_onomy_meta_boxes() in [...]/wp-content/plugins/cpt-onomies/admin.php on line 416

    Line 416 reads:

    public function add_cpt_onomy_meta_boxes( $post_type, $post )

    That error looks perplexing, since the above function does indeed have two arguments, but I suspect the problem lies one layer back:

    // add CPT-onomy "edit" meta boxes
    add_action( 'add_meta_boxes', array( &$this, 'add_cpt_onomy_meta_boxes' ), 10, 2 );

    Compare this to the other plugin, custom-fields-creator/wck-cfc.php:

    add_action('add_meta_boxes', 'wck_cfc_add_side_boxes' );

    and:

    function wck_cfc_add_side_boxes()

    According to the WordPress codex page, add_action() takes two required parameters and two optional ones.

    Does this error result from the different number of parameters specified by the two plugins? Do you know of a way to resolve it short of persuading plugin authors to use the same number of parameters for add_meta_boxes [whether or not they're needed]? Or does the true source of the conflict lie elsewhere?

    http://wordpress.org/extend/plugins/cpt-onomies/

  2. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    I installed that plugin on my testing site and did some digging and it looks like the problem is when the action is invoked in the WCK plugin.

    Look in the wordpress-creation-kit.php file in the wordpress-creation-kit-api folder on line 1071: do_action( 'add_meta_boxes', $this->hookname ); is missing the second argument.

    But, really, the 'add_meta_boxes' action shouldn't be used on settings pages because it's intended for dealing with posts, which is the why the missing second argument should be a variable containing post information.

    In CPT-onomies, I hook into an admin_head action to add my settings page meta boxes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic