3
votes
Accepted
Show shipping class in admin product list
You can add a new column to the product admin overview that displays the shipping class of each product. Here's how you can do it:
Add the following code to your theme's functions.php file or a ...
2
votes
How to Remove All Widgets from Dashboard?
Remove Default WP metabox in dashboard:
@source https://github.com/vincentorback/clean-wordpress-admin/blob/master/dashboard.php
/**
* Removing dashboard widgets.
*
* @link https://developer....
2
votes
Accepted
Set Featured Image of a post
To set a featured image when creating a post using wp_insert_post(), you can use the set_post_thumbnail() function
// Create the post
$post_id = wp_insert_post($args);
// Check if the post was ...
2
votes
Select a Text for CSS
Start by creating a stylesheet for your plugin.Then you can use the do_action('admin_enqueue_scripts') to enqueue it in the controlpanel only, avoiding it to be loaded in the frontend.
You could do ...
2
votes
Load specific CSS file
/**
* Enqueue a script or stylesheet in the WordPress admin on edit.php.
*
* @param string $hook_suffix Hook suffix for the current admin page.
*/
function wpse426722_admin_enqueue( $hook_suffix ) ...
1
vote
Accepted
Array() displaying in all pages of admin -view page source
It might be added during development, most probably coming from Theme or Plugin, The best way to debug is download active plugins and active theme using this plugin Download Plugin/ Theme, and open ...
1
vote
Accepted
admin showing Array() after adding exit() code
Download your theme using Plugin: Download Theme, and search using code editor like VSCode.
1
vote
Accepted
How to use native wordpress translation domain inside a custom plugin?
How to use native wordpress translation domain inside a custom plugin?
You would use __() without a textdomain, but this won't work for you because that's not how post status labels work.
...
1
vote
Wordpress admin area not sending mail (but works with WP Mail SMTP, Test Mail, and PHP mail() function)
I found the issue, had to edit /etc/php/8.3/cli/php.ini file, by adding/editing following lines :
[mail function]
; For Win32 only.
; https://php.net/smtp
#SMTP = localhost
SMTP = mysmtpserver.domain
;...
1
vote
Wp-admin wrongly redirecting on multisite
Solved it adding an annotation to the ingress:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/configuration-snippet: |...
1
vote
disable admin bar except administrator
Your third one looks like it should work, though it's a bit hard to read. I'd recommend something like this:
add_filter( 'show_admin_bar', 'wpse424492_admin_bar', 10000 );
function ...
1
vote
Fetch Post Category
If you want to display and fetch all post categories that have posts associated with them and display them in a dropdown list in the WP admin panel, try below the code add in code to your themes ...
1
vote
How can I have an admin only non-dashboard page in my Wordpress plugin
You'll need something like this:
function your_callback() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
// add your code here to display the menu for admins only
}
Basically ...
1
vote
How does the security of admin_ajax.php work?
If you look at the source of admin-ajax.php, the answer becomes clearer:
$action = $_REQUEST['action'];
if ( is_user_logged_in() ) {
// If no action is registered, return a Bad Request response.
...
1
vote
Accepted
Error 403 on wp-admin - Redirection to upgrade.php
The Error 403 with a redirection to upgrade.php in a WordPress site's admin area can be a bit tricky to diagnose and resolve, as it can stem from various issues, including file permissions, server ...
1
vote
Wildcard multisite wp-admin url wrongfully redirected
Take a look at your wp-config.php file. For a subdomain installation, you should have something like this:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', '...
1
vote
login_enqueue_scripts changes are not reflecting
Edit: Turns out my issue was the LiteSpeed cache plugin. It got resolved as soon as I purged the cache. I am disabling the cache for the development server for now. 🤦🏽♂️
1
vote
Edit image preview is not displayed
Make sure that not only wp-config.php, and functions.php has no empty lines.
In my case it was one of my custom theme files, which was included with include PHP function inside of single.php file.
I ...
1
vote
How to check if a user is in a specific role?
If your site happens to be using WooCommerce, you can simply use:
wc_current_user_has_role( $role );
If not, you can just create the function yourself by copying the way WooCommerce does it (...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wp-admin × 2318admin × 231
plugins × 183
plugin-development × 171
custom-post-types × 156
php × 120
admin-menu × 120
login × 114
posts × 110
customization × 100
functions × 91
dashboard × 89
ajax × 77
users × 77
redirect × 72
multisite × 66
filters × 63
pages × 59
jquery × 59
menus × 55
javascript × 54
hooks × 51
security × 50
custom-field × 46
metabox × 46