Hi folks, Today I am going to share extremely useful tips and tricks for WordPress websites which will work with your functions.php and wp-config.php files.
This tutorial is designed for WordPress developers as well WordPress website owners whoa care about his WordPress website. Below is some useful trick for your WordPress website.
Are you want to empty your trash items automatically, then open your wp-config.php file from your root directory of your website and copy paste below snippets at the end of the file. 7 number is the number of days between the emptying your trash items.
1 2 3 | < ?php define('EMPTY_TRASH_DAYS', 7 ); ?> |
Are you want to disable your default built-in editor where you can edit your code using your website admin panels, then keep a close eye in this tutorial as I have added below code to remove default editor from your WordPress website. Copy paste below code in your functions.php file at the end of the file and save it.
1 2 3 4 5 6 7 8 9 | < ?php function remove_editor_menu() { remove_action('admin_menu', '_add_themes_utility_last', 101); } add_action('_admin_menu', 'remove_editor_menu', 1); ?> |
Open your functions.php file and add below code at the end of the file to restrict access to admin area to administrator user only. It is a good way to keep away your website users from your admin area.
1 2 3 4 5 6 7 8 9 10 11 12 | < ?php function restrict_admin_access(){ global $current_user; get_currentuserinfo(); if (!array_key_exists('administrator', $current_user->caps)) { wp_redirect( get_bloginfo('url') ); exit; } } add_action('admin_init', 'restrict_admin_access', 1); ?> |
Add below code in your functions.php file of your current activated theme to completely remove the Screen Options tab from the admin area. Below filter will remove your Screen Options.
1 2 3 4 5 6 7 8 9 10 | < ?php function remove_screen_options_tab() { return false; } add_filter('screen_options_show_screen', 'remove_screen_options_tab'); ?> |
Hope thi stutorial helps you. If you enjoy this tutorial, then like & share this tutorial with your friends on socail media, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: wordpress, wordpress beginner, wordpress beginners, wordpress beginners tutorial, wordpress tips and tricks, wordpress tutorials for beginners