Articles of wp admin

Unable to display WordPress admin bar in the frontend as an admin

I’ve inherited a WordPress multisite install. I’m in the process of redesigning several of the subsites and I’ve noticed that WordPress is not displaying the admin bar in the front-end, even as an admin. Initially I thought it was a theme error so I went ahead and changed to a stock WordPress theme such as […]

Prevent add_filter being applied to wp-admin pages

I’m applying a filter to a custom fields plugin. add_filter(‘acf/load_value’, word_swap); My problem is this applies it to pages within the wp-admin also. I only want the filter applied to the actual WP site, and not the admin panel. How can I prevent the filter being applied to the wp-admin pages? I imagine I’d do […]

Network activating; if ( !current_user_can( ‘manage_options’ ) ) locks me out…

iHi, I use this snippet in a plugin; if ( ! ( current_user_can( ‘manage_options’ ) ) ) do something } but problem is, when network activating this on a multi-site installation, I get locked out of admin pages. WP says “You don’t have authority to this page” or something (translating from Swedish). I have, by […]

Displaying “One Time” Notification in Plugins

In WordPress’s backend, you can add notifications and errors using HTML that looks like this <div class=”updated error”> <p><?php esc_html_e( ‘A bad thing happened!’, ‘your-text-domain’ );?></p> </div> You can add these notices using the admin_notices hook. add_action( ‘admin_notices’, function(){ ?> <div class=”updated error”> <p><?php esc_html_e( ‘A bad thing happened!’, ‘your-text-domain’ );?></p> </div> <?php } ); […]

What is the correct way to get only display plugin for Administrator Only

Currently I’m a little confused with the usage of is_admin() and current_user_can( ‘manage_options’ ) What is the right way for it? At this moment I use is_admin() to include files for Administrator: if (is_admin()){ //include here };

Remove query var on admin pages when 'Save changes' pressed

In the admin backend we use a query arg that is left in the URL and keeps getting used whether it is supposed to or not. Our plugin has an array with values that can be toggled via the custom backend page. Against the option that should be toggled there is a link titled ‘Activate’ […]

Woocommerce: Add column to ORDERS admin page with items purchased

After updating to Woocommerce 3.0, in the Woocommerce ORDER page (where you can check all the orders made by customers, with order status, billing address, shipping address, total, etc.) is missing the column with the items purchased by the customer. Before WC update, that column was there. Now it is gone. Could anyone help me […]

jQuery UI tab does not work in the plugin page

I am trying to show a jquery-ui tab in a plugin page through the function billing_settings_page. As jQuery and jQuery UI are loaded automaically, so I thought I wouldn’t need to include them. But a bit googling told me to include jQuery UI tab as well. My code follows. I do not even find ay […]

Custom plugin admin page issues

I have created custom plugin to add admin page as shown in screenshot below. I am getting the following warning: Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /wp-includes/class-wp-hook.php on line 298. Here is my code: add_submenu_page( “Add / Edit Price Options in Kilometers”, “Add / Edit […]

Is it possible to take over a WordPress site if the old administrator is MIA?

I do have a username and password, yet cannot make key changes through the dashboard. For ex. I have not been able to change the site header image. I’ve gone through the steps I’ve found online to how to do it, yet even though it shows that I’ve changed the header (via the dashboard), it […]