Why are my styles being applied to the admin area?

Why are my styles being applied to the admin area? Assuming that is all of the code, it is because you are enqueueing the styles globally. You need to hook that to wp_enqueue_scripts, which will only load on the front end. wp_register_style( ‘main-styles’, get_stylesheet_directory_uri() . ‘/css/styles.css’, false, ‘1.0.0’, ‘all’); function enqueue_script_front_wpse_84975() { wp_enqueue_style(‘main-styles’); } add_action(‘wp_enqueue_scripts’, … Read more

Remove default subpages from Custom Post Menu

You can manipulate the global variable $submenu and remove them. In normal circumstances, the index key values are 5 (All items) and 10 (New item). In this example, the post type is portfolio: add_action( ‘admin_init’, ‘remove_cpt_submenus_wpse_95797’ ); function remove_cpt_submenus_wpse_95797() { global $submenu; unset( $submenu[‘edit.php?post_type=portfolio’][5], $submenu[‘edit.php?post_type=portfolio’][10] ); }

Disable HTML (Text) Tab in Post Editor

I was hunting for a way to do this, and no-one seems to mention the wp_editor_settings filter. This worked for me: function my_editor_settings($settings) { $settings[‘quicktags’] = false; return $settings; } add_filter(‘wp_editor_settings’, ‘my_editor_settings’);

How can I restore admin capabilities?

The string below actually represents an array in serialized form. a:1:{s:13:”administrator”;s:1:”1″;} Here: a:1 means an array with a single element s:13 means string and the length of the string followed by Array { “administrator” => “1” } Once that is in the table, you can use the unserialize() function to return it to an array … Read more

Help with shortcode in admin-ajax [closed]

How you are applying a filter is wrong. You need to bind a function to the filter, but you are providing a variable. function my_filter( $content ) { return $content . ‘My added code’; } add_filter( ‘the_content’, ‘my_filter’ ); You should add the code like this, this should work.