WordPress.org

Ready to get started?Download WordPress

Forums

Bug Library
UnHook MetaBox Save (7 posts)

  1. Shaun MacRae
    Member
    Posted 3 years ago #

    Hi Guys,

    I looked high and low for a plugin like this and was so happy to finally get it installed and working so well.

    Problem is, it broke one of our other core plugins.

    When bug library is installed it somehow prevents the other plugin from saving post metabox info. When I disable bug library, all is well.

    Here is a post discussing the problem I am having in more detail.
    http://premium.wpmudev.org/forums/topic/sales-price-not-updating

    Any thoughts?

    Thanks in advance,

    Shaun

    http://wordpress.org/extend/plugins/bug-library/

  2. Yannick Lefebvre
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Shaun,

    Sorry for the lack of response. I got very busy over the past few months in my personal life so I did not get a chance to see the messages posted here.

    I looked a bit at the code and what might be happening is that the other plugin that you are using might be running its post save routine after mine and my code might be conflicting. I did look through the code and the only thing I can think of doing would be to decrease the priority of my plugin save routine to see if it helps.

    Try changing the number 10 on line 93 to a higher number (50 or 100) and see if that helps the two plugins co-exist.

    Let me know if this helps and I can make it a permanent change.

    Yannick

  3. Shaun MacRae
    Member
    Posted 3 years ago #

    Thanks Yannick.

    I had tried that but no go.

    Note: I may be running a slightly different version (1.01) than you as it appears on line 91 for me.

    I tried 50, 100, even 1000:
    add_action('save_post', array($this, 'add_bug_field'), 1000, 2);

    Thanks for idea though.

    Both plugins have an add_action('save_post' .... So, shouldn't the designated save routine be called for both? If that's true it should work because both plugins seem to be protecting the logic around specific post types.

    Shaun

  4. Yannick Lefebvre
    Member
    Plugin Author

    Posted 3 years ago #

    That's what has me a bit puzzled. My understanding of the actions such as this is that every registered action would get called. And yes, I am protecting the code by checking the post type.

    I will do a bit more research and get back to you on that.

    Yannick

  5. Shaun MacRae
    Member
    Posted 2 years ago #

    Hi Yannick,

    I think I found the problem. In your code you have:

    function add_bug_field($ID = false, $post = false) {
    		if ($post->post_type = 'bug-library-bugs')
    		{

    I'm not sure $post is getting set properly, so the logic in this method is not blocking as it should. I believe the logic is executed for other post-types causing their own save logic to fail.

    If I add a line to get_post, it seems to fix everything:

    function add_bug_field($ID = false, $post = false) {
    		$post = get_post($ID);
    		if ($post->post_type = 'bug-library-bugs')
    		{

    Let me know what you think about incorporating it in.

    Thanks,

    Shaun

  6. Yannick Lefebvre
    Member
    Plugin Author

    Posted 2 years ago #

    I just incorporated your change in the latest release.

  7. Shaun MacRae
    Member
    Posted 2 years ago #

    Working well.

    Thanks Yannick!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic