• JuniperPaul

    (@juniperpaul)


    Custom Post Type Creator version 1.0.1

    Madalin, I’m wanting to use your plugin in combination with another plugin (CPT-onomies by Rachel Carden) that creates admin meta boxes, and I’m finding that the method of hooking into WordPress that she’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

    …where 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 your 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. Both plugins look like they’re written correctly, but I’m wondering whether the first instance of add_action('add_meta_boxes'...) WordPress is executing is setting up the next instance to fail?

    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/custom-post-type-creator/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter JuniperPaul

    (@juniperpaul)

    I posted this same problem to the CPT-onomies plugin support forum, and Rachel’s response is illuminating:

    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.

    @juniperpaul: I’m curious on why would you need to use this plugin along with CPTnomies? Won’t they both create custom post types?

    CPTnomies has, I guess, a wider use, since it not only creates CPT but it also enables you to use it as a custom taxonomy.

    Thread Starter JuniperPaul

    (@juniperpaul)

    Specifically, I was trying out your WCK Custom Meta Boxes plugin. For a long time I’ve been enjoying the rich functionality of Hiroaki Miyashita‘s Custom Field Template, but its user interface is best used by a programmer and I’m always on the lookout for something menu-driven that my non-technical clients can use.

    I also had your WCK Post Type Creator and WCK Taxonomy Creator installed so I could assess them as a family, but I wasn’t using them to create any post types or taxonomies. The CPT-onomies error message is triggered when I select WCK > Post Type Creator or WCK > Taxonomy Creator to display the input fields for a new post type or taxonomy. Rachel Carden makes a persuasive argument that this represents a flaw in your plugins. I’m posting this to help you fix that problem.

    Yes, I use the CPT-onomies plugin because it lets us assign a post type as a taxonomy to another post type. This added functionality has been profoundly helpful in my work. CPT-onomies would not be necessary if WordPress’s taxonomy terms had all the richness of posts or pages, but they don’t and it is.

    Regards,
    Paul

    Hi Paul,

    I’m not actually the plugin’s developer. I was just searching for similar plugins to use myself and saw your message. I’ve tried CPTnomies myself and was curious about your use of it in conjunction with this one.

    Have you tried Types? It’s very powerfull.

    Maybe you can find this comparewp.org comparison usefull in your quest! (Not completely updated but usefull, nevertheless.) 😉

    Best
    Alvaro

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘plugin conflict with add_action('add_meta_boxes')’ is closed to new replies.