Tag Info

New answers tagged

0

It's even simpler if, like the OP, you only want to move Menus and Widgets out of Appearance and to the top level. That's what I needed too. Since we're just moving WP core menu items around, we don't need to use add_menu_page to add the menu items back in - we're not adding any new menu items. Just unset them from the $submenu array and re-set them ...


0

Displaying some custom text there can be done using views_plugins filter: add_filter('views_plugins', 'add_plugins_views', 10, 1); function add_plugin_views($views) { $views['foo'] => 'bar (?)'; return $views; } If what you need is actually setting a property for all plugins and display a count of this custom property you might want to take a ...


0

You might try this: function add_author_edit_link( $wp_admin_bar ) { if ( is_author() && current_user_can( 'add_users' )) { $currentUserID = get_current_user_id(); $args = array( 'id' => 'author-edit', 'title' => __( 'Edit Person' ), 'href' => '/wp-admin/user-edit.php?user_id=' . ...


1

You could try this modification of your code: function add_author_edit_link( $wp_admin_bar ) { if ( is_author() && current_user_can( 'add_users' ) ) { $args = array( 'id' => 'author-edit', 'title' => __( 'Edit Author' ), 'href' => admin_url( sprintf( ...


1

I'm not 100% sure exactly what you wish to place in the 'last revision' column, but just so you are aware you can switch the view on the Posts table to Excerpt View using the button below the search box. This view allows you to see the first few lines of the post as well as all of the other default information - Please see this page for more information ...


0

Try this. Hopefully I've interpreted your output correctly. I'd recommend a good read of the $wpdb codex, particularly in relation to the get_col() method - http://codex.wordpress.org/Class_Reference/wpdb#SELECT_a_Column global $wpdb; // You won't need this unless this code is within a function $query = $wpdb->prepare( 'SELECT %1$s.guid FROM ...


0

You need to find the right $menu_slug. The following code worked for me: add_action( 'admin_init', 'remove_menus' ); function remove_menus(){ remove_menu_page( 'wpcf7' ); }


0

Here's what I ending up using thanks to Milo, the Codex and this post from http://simple2kx.com/. add_action( 'manage_issues_pm_posts_custom_column', 'my_manage_issues_pm_columns', 10, 2 ); function my_manage_issues_pm_columns( $column, $post_id ) { global $post; switch( $column ) { /* If displaying the 'issues_type' column. */ case 'issues_type' : ...


0

I have achieved same with this: function add_custom_menu_item(){ add_menu_page( 'Menu Item Title', 'Page Title', 'manage_options', 'page_slug', 'function', 'dashicons-icon', 1 ); } add_action( 'admin_menu', 'add_custom_menu_item' ); function custom_menu_item_redirect() { $menu_redirect = isset($_GET['page']) ? $_GET['page'] : false; ...


0

I had the same issue 5000+ pages, which made it take quite some time. The issue was Page Attributes which used wp_dropdown_pages -> loading all pages! Since I still needed the possibility to use templates, only removing Page Attributes wasn't going to solve it. And since I don't like to hack directly in core files, my solution was to remove then re-enable ...


0

To add a top-level menu page, you need to use add_menu_page instead of add_options_page (which adds a sub-menu item to the "Settings" menu). add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $callback_function, $icon_url, $menu_position ); http://codex.wordpress.org/Function_Reference/add_menu_page


0

if you don't like this method. maybe you would like the follow code: you can try to put the follow code in your functions.php file- // Theme options /* get options & set default options */ if( !function_exists('share3h_theme_get_options') ) : function share3h_theme_get_options($option){ $share3h_theme_options = ...


0

You can use OptionTree plugin https://wordpress.org/plugins/option-tree/ It also can been worked in theme mode.


0

Yes, you can Change email address by using wp_mail function. You can check this how to do this http://www.butlerblog.com/2011/07/14/changing-the-wp_mail-from-address-with-a-plugin/ Use this plugin for user management it supports email address when new user registers https://wordpress.org/plugins/wp-members/ Use this code in your functions.php file. ...


2

Rather than blacklist logins, why not whitelist your own IP (example 12.345.67.891 below; or a range) for wp-login.php and in wp-admin for logins and administration? (No plugin needed). A whitelist will block everyone else except you from login. See http://httpd.apache.org/docs/2.4/howto/access.html in the .htaccess in the wp-admin folder: Options All ...


0

Make Sure Your Functions, Slug and Callback Functions are Unique(Means Different from any other plugin or default WordPress). Also to save options use Settings API http://codex.wordpress.org/Function_Reference/register_setting <?php add_action('admin_menu', 'add_unique_custom_options'); function add_unique_custom_options() { add_options_page('Global ...


1

get_current_screen() is a pain, I use the following code to avoid/wrap it: /* * Convenience function to tell if we're on a specified page. */ function theme_is_current_screen( $base = null, $post_type = null ) { if ( ! $base && ! $post_type ) { return false; } $screen = function_exists( 'get_current_screen' ) ? ...


1

According with the codex, get_current_screen() has to be used later than admin_init hook. After a few tests, it seems that the safiest way is to use current_screen action hook instead of get_current_screen(): add_action('current_screen', 'current_screen_callback'); function current_screen_callback($screen) { if( is_object($screen) && ...


1

What you have does indeed sound more like production and development. General practice it that between these two the data only goes from production to development, but never the other way. Having true staging, you can push the data from to production, is challenging precisely for the reasons you describe. There are solutions around, but even those on ...


1

According to the documentation for add_menu_page: Note: If you're running into the "You do not have sufficient permissions to access this page" error, then you've hooked too early. The hook you should use is admin_menu. This means you need to wrap your menu creation in something like: add_action( 'admin_menu', function() { add_menu_page( ...


0

Open WP-Admin Editing File: Open the file located at: /example.com/public_html/wp-admin/edit-form-advanced.php Edit: Edit these lines to look like the next, adding target=”_blank” to each link or pasting the whole list. $messages = array(); $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __('Post updated. ...


3

You can use the wordpress function user_can that accepts as arguments the id of the user and a string representing a capability or a role name ('administrator' in your case ) and returns a boolean value. http://codex.wordpress.org/Function_Reference/user_can Referred to your code you can try this <?php if( !user_can( get_the_author_meta( 'ID' ), ...


0

use remove_submenu_page() like this : add_action('admin_menu','your_add_menu_function'); function your_add_menu_function() { add_menu_page('Menu Page Title','Menu Name','edit_theme_options/others caps...','parent_menu_slug',...); add_submenu_page('parent_menu_slug','Menu Page Title','Menu Name','...caps...','sub_menu_slug',...); ...



Top 50 recent answers are included