Advanced Custom Fields
The way the plugin add meta boxes breaks can be improvred (5 posts)

  1. Marko Heijnen
    Posted 4 years ago #


    I'm the author of Tabify Edit Screen ( http://wordpress.org/extend/plugins/tabify-edit-screen/ ). My plugin enables tabs in the edit screen and the user can manage them.

    The problem now is that your plugin doesn't really has a method to call that it only add the meta boxes for a certain post type. Even all is not a problem. I would say that the way you add meta boxes is wrong and that it would be a better way to add them when the action add_meta_boxes is called.

    My solution to make your plugin work in my plugin is the following code:
    http://plugins.trac.wordpress.org/changeset/529615. I was wondering what your comment is about this code. It now runs for every post type.


  2. elliotcondon
    Plugin Author

    Posted 4 years ago #

    Hi Marko,

    Thanks for the message. However, I think the language barrier is making it hard for me to understand your point.

    You say that "the way you add meta boxes is wrong and that it would be a better way to add them when the action add_meta_boxes is called."

    could you elaborator on that a bit more? ACF does make use of the add_meta_boxes function in the admin_head action.

    Also, the code you linked to doesn't help me understand what is happening.


  3. Marko Heijnen
    Posted 4 years ago #

    Hey Elliot,

    At this moment you make use of function add_meta_box() but you add them from the hook/action admin_head. In my opinion that is wrong and should been called from out the hook/action add_meta_boxes. When that happens my plugins (maybe others) doesn't have to add extra code.

    The code what I referred to is your own code but then in my plugin. To make it compatible with your plugin.

    If that isn't possible it would help me if the add_meta_box code in your plugin would be in a separate function. Your plugin would even be more robust since you can remove duplicated code and in my plugin I can call the function instead of copy the code from your plugin.


  4. elliotcondon
    Plugin Author

    Posted 3 years ago #

    Hi Marko,

    I've just posted a comment on the other topic which unfortunately outlines how our plugins are incompatible...

    ACF add's the metaboxes "on the fly" after using "location rules" to match the field groups to the current page.

    This means no plugin (not even ACF) will see any metaboxes added to a post type until you are on a post edit screen.

    Any chance you can add a filter into your plugin to allow for 3rd party devs (me) to add metaboxes into the global $wp_meta_boxes?

    * I think if I can hook into your plugin in the _get_metaboxes function, we should be able to find a solution!


  5. Marko Heijnen
    Posted 3 years ago #

    I'm busy with that already on my github repository. The code is now messed up due a rewrite to be able to add tabs on multiple places.

    Hopefully I will manage to have a final version by the end of this week.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic