Support » Plugin: Admin Page Spider » A couple of suggestions from a fellow plugin developer

  • Resolved Daniel Milner

    (@danielmilner)


    Congrats on your first plugin 🙂

    I just had a couple of suggestions.

    Instead of removing the Page Builder node in wp_before_admin_bar_render, just use remove_action('admin_bar_menu', 'FLBuilder::admin_bar_menu', 999)

    This would allow it to “play nice” with other plugins that may rely on that node existing and allow them to react accordingly.

    Also, I noticed that in apspider_admin_bar_removal function you are not checking your plugin settings to see if those menus are hidden. For example, if I hide the “Edit in Beaver Builder” menu, it shouldn’t remove the “Page Builder” node. Currently, the only way to get that menu back is to disable your plugin.

    Thanks.

    https://wordpress.org/plugins/admin-page-spider/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author jatacid

    (@jatacid)

    Thanks Daniel,
    I’m doing a bit of work to make it easier to add more settings so the hiding of default nodes will be in a future release 🙂

    As for your idea about ‘remove_action’, I tried it but for some reason it wasn’t working. I don’t think there’s anything wrong with my syntax?

    Cheers!

    Beaver Builder does their add_action right up front, so remove_action should work if you add it to the plugins_loaded action hook. You just have to make sure that remove_action happens after add_action.

    The only problem with hooking in to wp_before_admin_bar_render to remove an item, is that by that point, the admin bar is pretty much set in stone. Meaning that any plugins that are going to add their menus or sub-menus to it have already done so. Mainly, what I’m saying is that if you want to remove a menu item, you should probably prevent it from being added in the first place instead of removing it after it’s already there.

    In my situation, my plugin (Beaver Tunnels), adds a sub-menu to the Page Builder menu. I can run a check to make sure that the Page Builder menu exists and create my own menu if it doesn’t…but when the menu is removed right before it’s output to the page, everything gets lost.

    For now, I’ve added a specific check to look for the apspider_admin_bar_removal action hook and add my own menu if it exists.

    Btw, your plugin is great and I see it offering a great value to a lot of people.

    If you have any questions or are just stuck on something not working right. Feel free to hit me up. I’d be glad to help out.

    Plugin Author jatacid

    (@jatacid)

    I’m gonna go ahead and close this Daniel as it will be done in a future version. Thanks for the heads up!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A couple of suggestions from a fellow plugin developer’ is closed to new replies.