• Resolved auditt

    (@auditt)


    Hi there,

    I’m providing to the backend user some functionalities where admin menu items are added or removed based on certain actions. At the moment, I’m reloading the entire website after an action is triggered using JavaScript to reflect these changes in the admin menu.

    I was wondering if UIPress provides a specific hook or a function that I could use to refresh just the admin menu without having to reload the entire page? Your input is highly appreciated.

    Thank you.

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

    (@admintwentytwenty)

    Hey,

    This might be possible, are you using the uipress menu creator or just working with the default menu?

    The menu is output as a js variable on each page load so you could in theory replace that variable with your new menu and then fire the custom page load event.

    It would depend a lot on what exactly you are doing with the menu though.

    Thanks

    Mark

    Thread Starter auditt

    (@auditt)

    Hi there,

    I’m using the default menu.

    Just to give you a scenario, for my client I wrote a custom admin page to activate or deactivate some plugins. This is a typical call I do:

    activate_plugin($_GET['plugin']);

    Let’s say I decide to deactivate woocommerce. In this case, the database is written, the plugin is deactivated and the iframe will reload. But the menu stays as it is and woocommerce is still visible in the menu.

    My workaround is to trigger another reload (after iframes reload) per JS:

    window.top.location.reload()

    Thats why I asked if you have a php hook (or JS) to trigger a dedicated menu reload manually.

    Plugin Author UiPress

    (@admintwentytwenty)

    Ok, thanks for clarifying.

    This will happen automatically if activating / deactivating through the core wordpress page but yes you would need to reload the frame after deactivation for it to refresh the menu.

    Thanks,

    Mark

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Reload Admin Menu Hook’ is closed to new replies.