How to add php stylesheet to admin section instead of admin_head hook

If you enqueue your style sheet first you should be able to use wp_add_inline_style afterwards. function custom_style() { wp_enqueue_style(‘your_css’, plugin_dir_url( __FILE__ ) . ‘style/your_css.css’ ); $bg_color = get_option(‘custom_color’); $custom_css = ” body { background-color: {$bg_color}; }”; wp_add_inline_style( ‘your_css’, $custom_css ); } This is not tested (just written from mind) and I have never used it … Read more

How to select featured images for 1500 posts?

You can run a script that will programmatically set the featured image for each post. You can use the first attached image for this. To get the attached images run a query for the posts and loop through each one and use get_children() setting the post_parent to the current post id in your loop. $posts … Read more

New User Approval

You need to add_action two time for this. One at the time of user registration & second when user tries to login. function wpse_149067( $user_id ) { if ( user_can( $user_id, ‘tutor’ ) ) update_user_meta($user_id, ‘verified_user’, false); if ( user_can( $user_id, ‘student’ ) ) update_user_meta($user_id, ‘verified_user’, true); } add_action( ‘wp_login’, ‘wpse_149067_check_user’, 10, 2); function wpse_149067_check_user($user_login, … Read more