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. 🤦🏽♂️
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. 🤦🏽♂️
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’, ‘rareteas.com’); define(‘PATH_CURRENT_SITE’, “https://wordpress.stackexchange.com/”); define(‘SITE_ID_CURRENT_SITE’, 1); define(‘BLOG_ID_CURRENT_SITE’, 1); If you have SUBDOMAIN_INSTALL set to false, change it to true, which is necessary for a subdomain multisite. Next, take a look at your database. Sometimes … Read more
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. if ( ! has_action( “wp_ajax_{$action}” ) ) { wp_die( ‘0’, 400 ); } /** * Fires authenticated Ajax actions for logged-in users. * * … Read more
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 you need to check what capabilities the current user has and then select one which only admins have List of Roles & Capabilities … Read more
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 created successfully if (!is_wp_error($post_id)) { // Set the featured image if ($image_url) { // $image_url should be the URL of the image you want to … Read more
You can filter the posts list by appending ?category_name=xx to the admin posts list URL, and you can add a submenu page with that URL as the target via add_submenu_page: add_action( ‘admin_menu’, ‘wpd_admin_menu_item’ ); function wpd_admin_menu_item(){ add_submenu_page( ‘edit.php’, ‘Page title’, ‘Menu item title’, ‘edit_posts’, ‘edit.php?category_name=somecat’ ); }
The action wp_enqueue_scripts action hook is only on the frontend: try changing this to admin_enqueue_scripts for the admin (untested): add_action( ‘admin_enqueue_scripts’, ‘cf7_script_and_style’ ); Edit: After looking at the definition for wpcf7_enqueue_scripts(), it turns out that CF7 doesn’t anticipate being loaded in the admin: who would’ve guessed. You’ll need to copy a lot of that file … Read more
No, there isn’t. Unless there’s an apply_filters() call, you can’t modify any of the output. You mentioned “the only hook is to the entire function”, but that’s not the case either. There is a do_action() call at the end, but this is an action hook, so it only lets you run something at the end … Read more
function add_read_wpse_93843(){ $role = get_role( ‘subscriber’ ); $role->add_cap( ‘read’ ); } add_action( ‘admin_init’, ‘add_read_wpse_93843’ ); This code is work for me
I suspect that if you enable the Network tab in your browser Diagnostics screen (usually F9, but right-click and select ‘inspect’). you will see that a CSS file is not getting loaded for some reason. This is probably a theme issue of not properly loading the CSS. Could also be a caching issue; perhaps the … Read more