WordPress add_options_page() function not considering role

Your understanding is incorrect. The third parameter to the add_options_page() function is Capability, not Role. This is made clear by the function’s prototype: function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = ” ) manage_options is a Capability. Administrator is not.

How to minimize WP dashboard menu programmatically?

Add a javascript to all admin pages: add_action( ‘admin_print_scripts’, ‘auto_collapse_menu’ ); function auto_collapse_menu(){ wp_enqueue_script( ‘autocollapsemenu’, plugins_url( ‘autocollapsemenu.js’, __FILE__ ), array( ‘jquery’ ), false, true ); } The javascript: jQuery(document).ready( function($){ // catch every click inside element with ID ‘adminmenu’ $( ‘#adminmenu’ ).click( function(e){ // true if the menu is folded, false if not var bodyFolded … Read more

Edit Page or Post from Top Admin Bar

Typically most themes will include an edit link on the post/page itself that takes you directly to the backend to edit the post. If not, you can always add it yourself with code similar to the following in single.php, page.php, etc.: <?php edit_post_link(‘(Edit this post)’, ‘<p>’, ‘</p>’); ?> (See http://codex.wordpress.org/Function_Reference/edit_post_link for more details.) Also, check … Read more

Show admin menu and toolbar in admin post page

What you see on that image is the full-screen mode which is the default mode in the block editor (that applies to Pages, Posts and custom post types), and which is intended to help users to work without distraction. Secondly, there’s also a note in wp-admin/admin-header.php which says that // Default to is-fullscreen-mode to avoid … Read more

Admin Menu – Highlight top-level menu when on a sub-menu page (without showing sub-menu)

That’s a bit of a late answer and I don’t know if @Jay ever sorted it out, but to anyone having the same issue, here’s how I fixed it. Menu Pages function my_admin_menu() { add_menu_page( ‘Page title’, ‘Menu title’, ‘manage_options’, ‘my_page’, null, null, 99 ); add_submenu_page( ‘my_page’, ‘Subpage 1 title’, ‘Subpage 1 menu title’, ‘manage_options’, … Read more

WordPress setting API strucked

You are Missing few Things. First of all hook the function wpt_theme_init with admin_init or similar one. otherwise your function will not execute. example below add_action( ‘admin_init’, ‘wpt_theme_init’ ); add_settings_section and add_settings_field take 4th argument as a $page parameter. which is wptsettings in your case. remember? you have named your page wptsettings in add_theme_page ( … Read more

Admin page menu keeps bugging out

It’s an issue with Chrome. It was reported on the Google Chrome product forum today now that it has hit the stable release. I originally saw this issue on this thread: WordPress admin menu formatting issue I wrote a quick plugin as a workaround until they fix it: https://github.com/raffjones/chrome-admin-menu-fix.

WordPress admin menu formatting issue

Otto has suggested a fix in Chrome itself until the bug is resolved: Go to chrome://flags/#disable-slimming-paint Enable the “Disable slimming paint” option. Ensure that the “Enable slimming paint” option below it is not turned on. Relaunch Chrome. If you don’t want to take this approach you can fix this with CSS: function chromefix_inline_css() { wp_add_inline_style( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)