Registering for a domain on WordPress

We don’t know if you are using self-hosted WordPress, localhost or wordpress.com. Read about the differences between WordPress.COM and .ORG: WordPress.com and WordPress.org — Support — WordPress.com to determine the differences and find out your options for registering a domain. You can register a domain using wordpress.com along with using that service. If self-hosted WordPress, … Read more

Where is function to prevents non logged users access wp-admin?

You will need to use the authenticate filter: https://codex.wordpress.org/Plugin_API/Filter_Reference/authenticate add_filter( ‘authenticate’, ‘myplugin_auth_signon’, 30, 3 ); function myplugin_auth_signon( $user, $username, $password ) { return $user; } Return a WP_Error object to indicate failure or an issue, or a WP_User object on success. There are also 2 core functions hooked into that filter that will need removing … Read more

Mowing site to another domain in simplest way

Unfortunately there’s nothing native in WordPress to handle searching and replacing your domain name across all your posts, options, etc. The closest you can get is WP-CLI’s search-replace command. It’s not an official WordPress project, but it has quite a high adoption rate, it’s very well maintained and available by default or on demand on … Read more

Change users.php WP_User_Query

pre_get_users is the action that is fired before a user query is run. You need to check the context of the action to make sure you’re on the main users screen. You can then alter the query with any parameters accepted by WP_User_Query. A quick example: function wpd_filter_users( $query ) { $screen = get_current_screen(); if( … Read more

Disable Auto-Expanding Menu in WordPress Admin Menus

I see two options here – override the CSS, or remove the “active” classes with JavaScript (sadly there is no action/filter that we can do this server-side) – I opted for the JS approach, it’s cleaner, leaner and meaner: function wpse_227037_remove_menu_classes() { echo ‘<script>jQuery( “.wp-has-current-submenu.wp-menu-open” ).removeClass( “wp-has-current-submenu wp-menu-open” ).addClass( “wp-not-current-submenu” );</script>’; } add_action( ‘adminmenu’, ‘wpse_227037_remove_menu_classes’ … Read more

Redirect Plugins.php to New Plugin Page

After a little bit of trial and error, I finally got my code to work. This will redirect http://example.com/wp-admin/plugins to http://example.com/wp-admin/admin.php?page=pretty-plugins.php if the current user doesn’t have access to update core. add_action( ‘admin_menu’, ‘block_direct_plugin_page_access’ ); function block_direct_plugin_page_access() { global $pagenow; if ( ! current_user_can(‘update_core’) && ‘plugins.php’ === $pagenow ) { if ( function_exists(‘admin_url’) ) { … Read more

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