Make sub menu items a main link in the admin menu using fuctions.php

OK, it’s a bit messy, but it works. Take a look function remove_submenus() { global $submenu; unset($submenu[‘themes.php’][10]); // Removes Menu } add_action(‘admin_menu’, ‘remove_submenus’); function new_nav_menu () { global $menu; $menu[99] = array(”, ‘read’, ‘separator’, ”, ‘menu-top menu-nav’); add_menu_page(__(‘Nav Menus’, ‘mav-menus’), __(‘Nav Menus’, ‘nav-menus’), ‘edit_themes’, ‘nav-menus.php’, ”, 99); } add_action(‘admin_menu’, ‘new_nav_menu’); Essentially it is removing the … Read more

Disable slow media queries?

Solution for WordPress versions >= 4.7.4 (4.8) Ticket #31071 introduces patches with new filters to override three possible slow media queries, in the wp_enqueue_media() function: media_library_show_audio_playlist (@param bool|null) From the inline doc: Whether to show the button, or null to decide based on whether any audio files exist in the media library. media_library_show_video_playlist (@param bool|null) … Read more

Set “Display name publicly as” to be usernames by default

If you want this for all future users then hook into the user_register event and update it there. Pull the WP_User using get_userdata and wp_update_user info with the new display name. add_action( ‘user_register’, ‘wpse_20160110_user_register’, 10, 1 ); function wpse_20160110_user_register ( $user_id ) { // get the user data $user_info = get_userdata( $user_id ); // pick … Read more

Upgrade to SSL Breaks Admin Dashboard

Not sure what plugin you are using to enforce SSL, but I would disable it to prevent conflicts with the possible solution below. To make sure you’ve updated all of your URLs to the HTTPS, do the following: Go and download Interconnect IT’s Database Search & Replace Script here Unzip the file and drop the … Read more

How to show an error message after publishing a post?

I wouldn’t use that hook. Here’s why Try something like this using admin_notices. function wpsites_admin_notice() { $screen = get_current_screen(); if( ‘post’ == $screen->post_type && ‘edit’ == $screen->base ){ ?> <div class=”error”> <p><?php _e( ‘Updated Demo Message!’, ‘wpsites’ ); ?></p> </div> <?php }} add_action( ‘admin_notices’, ‘wpsites_admin_notice’ ); Untested.

wp login redirects to homepage

Piggybacking on Denis’s comment about the site’s domain having changed…. if you can get access to the database (ie. if your host has phpmyadmin on its control panel) check the ‘siteurl’ option in the wp_options table of the database. If that option is set to an address that redirects or doesn’t resolve, you won’t be … Read more

How to disable 3.3 Tooltips?

You could also remove the pointer script and style from their respective arrays just after they have been registered using this method. // Remove javascript add_action( ‘wp_default_scripts’ , ‘remove_pointer_script’ ); function remove_pointer_script( $wp_scripts ) { $wp_scripts->remove(‘wp-pointer’); } // Remove stylesheet add_action( ‘wp_default_styles’ , ‘remove_pointer_style’ ); function remove_pointer_style( $wp_styles ) { $wp_styles->remove(‘wp-pointer’); } The remove method … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)