Allowing `get_option_tree` on the admin side (5 posts)

  1. spencersokol
    Posted 5 years ago #

    Is there any specific reason to disallow the use of get_option_tree on the admin side?

    I have a scenario where I'd like to use it: A custom user role has access to the admin area to modify custom data, but not access to any other WP admin section. The admins need to have editable help text for those users and this plugin would be a simple way for me to add it.

    (I understand that normally this kind of user would edit the data on the front end, but the client did not order designs for those pages, so it's in the WP admin area.)

    For now, I'm allowing it (with no visible side-effects) by adding this to my plugin's admin_init action hook:

    if ( defined( "OT_PLUGIN_DIR" ) && file_exists( OT_PLUGIN_DIR . '/functions/get-option-tree.php' )  ) {
      require_once( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );

    Of course, I'd rather not have to make this check. ;)

  2. Paulo Magalh„es
    Posted 5 years ago #

    within the file:


    Go to line 28, paste in next line this:

    include( OT_PLUGIN_DIR . '/functions/get-option-tree.php' );

    This will work, using own resources the plugin. The function oprtion-tree will now work in the wp-admin as well.

  3. spencersokol
    Posted 5 years ago #

    You can do that, but it can (and probably will) get overwritten in the next OptionTree update, which is why I chose to load it in my plugins admin_init action hook instead.

  4. Paulo Magalh„es
    Posted 5 years ago #

    Yes, you're right.

  5. Derek Herman
    Plugin Author

    Posted 4 years ago #

    Added function to the admin side in 1.1.8 coming out soon.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • OptionTree
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic