Blog

How to enable ‘POST REVISIONS’ in WordPress

‘POST REVISIONS’ help us to fallback to a earlier version of the posts/pages if you accidentally/intentionally modified the contents of that particular posts/pages and want to restore the previous contents immediately. By default, POST REVISIONS are kept disabled after a fresh WordPress installation. But wait, you can enable that by following some simple steps as

Read More

How to modify default “sub-menu” class for child menu in WordPress

Sometime we are needed to modify the default “sub-menu” class for the child menu in wordpress. There is no direct way you can do that but this can be done by placing a sample code in your functions.php like below: function change_submenu_class($menu) { $menu = preg_replace(‘/ class=”sub-menu”/’,’/ class=”submenu” /’,$menu); return $menu; } add_filter(‘wp_nav_menu’,’change_submenu_class’);

Read More

Adding an Admin User in WordPress Using Only FTP

Add the Below codes to functions.php function wpb_admin_account() { $user = ‘Username’; $pass = ‘Password’; $email = ’email@domain.com’; if ( !username_exists( $user ) && !email_exists( $email ) ) { $user_id = wp_create_user( $user, $pass, $email ); $user = new WP_User( $user_id ); $user->set_role( ‘administrator’ ); } } add_action(‘init’,’wpb_admin_account’); Don’t forget to replace Username, Password, and

Read More

How to Show Number of Registered Users in WordPress with Code

You need to add the following code to your theme’s functions.php file or a site-specific plugin. // Function to return user count function wpb_user_count() { $usercount = count_users(); $result = $usercount[‘total_users’]; return $result; } // Creating a shortcode to display user count add_shortcode(‘user_count’, ‘wpb_user_count’); This code creates shortcode [user_count] which you can use in your

Read More