Tag Info

New answers tagged

0

Here is how i accomplished this.. Inside of the admin_menu action, I added a submenu item to the parent menu item ('nwcm') with the URL parameter of the taxonomy edit page. add_submenu_page('nwcm', 'News categories', 'News categories', 'edit_posts', 'edit-tags.php?taxonomy=nwcm_news',false );


0

It can not work for user roles that don't see and don't have access to the menu section. It just is not there - for them -, so you can't address it, hence the errors you are getting. Just add a check: if( current_user_can( 'edit_posts' ) ) { //code }


0

So as the first option was loading wired i have come to a better solution. what we will do in this case is to create a new menu item, put it in first position, give a custom class, needed to add cutom css style for that item. For this we will: create a function to add new menu item create a function to load custom stylesheet to admin panel and create the ...


0

I was wondering the same thing. There's a modern version that uses admin_enqueue_scripts: add_action('admin_menu', function () { $settingsPage = add_options_page('Settings', 'Mortgage Calculator', 'manage_options', 'mortgagecalculator', function () { echo "<div id='app'></div>"; }); /** * Include the ember admin scripts only on ...


0

The quick and dirty answer would be something like this: function custom_admin_menu_links() { $user = wp_get_current_user(); if ( $user->has_cap( 'manage_options' ) ) { $type = 'book'; $page = get_page_by_title('home','object',$type); if (!empty($page)) { add_menu_page( 'Home', 'Home', 'edit_posts', ...


0

There is a function called get_page_by_title that accepts a post title and returns the ID of that post. You might even use it in conjunction with get_edit_post_link by passing the ID and retrieve the edit link. However, how can you be sure the post's title will never change? You could go a little further and add a settings page where you would map a ...



Top 50 recent answers are included