This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//below code snippet is to be added to WordPress theme functions.php file | |
//option 1: remove the WordPress admin bar for all users | |
add_filter('show_admin_bar', '__return_false'); | |
//option 2: hide the WordPress admin for everyone except users with administrator privileges | |
add_action('after_setup_theme', 'remove_admin_bar'); | |
function remove_admin_bar() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To access the functions.php file through your WordPress Admin interface, follow these steps: | |
Step 1: Log in to the WordPress Admin interface. | |
Step 2: In the left sidebar, hover over "Appearances", then click "Theme Editor" (recommended to use child theme). | |
Step 3: In the right sidebar, click functions.php and you can the code snippet at the bottom of the file. | |
Step 4: Click "Save" to apply the changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this code snippet to the wp-config.php file to increase your memory limit to 100MB | |
define('WP_MEMORY_LIMIT', '100M'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add below code into wp-config.php | |
define('EMPTY_TRASH_DAYS', 1 ); //Integer is the amount of days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//below code snippet is to be added to WordPress theme functions.php file | |
//enable SVG upload | |
function tt_enable_svg_upload( $mimes ) { | |
//Only admin can upload SVG file | |
if ( !current_user_can( 'administrator' ) ) { | |
return $mimes; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//below code should be added into your wp-config.php file | |
//Example 1: autosave every 30 seconds | |
define('AUTOSAVE_INTERVAL', 60); //autosave every 60 seconds | |
//Example 2: autosave every 5 minutes | |
define('AUTOSAVE_INTERVAL', 300); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this code into functions.php to disable search | |
function tt_filter_query( $query, $error = true ) { | |
if ( is_search() & !is_admin()) { | |
$query->is_search = false; | |
$query->query_vars['s'] = false; | |
$query->query['s'] = false; | |
// to error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this code into functions.php to disable search | |
function tt_filter_query( $query, $error = true ) { | |
if ( is_search() & !is_admin()) { | |
$query->is_search = false; | |
$query->query_vars['s'] = false; | |
$query->query['s'] = false; | |
// to error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this code into your theme functions.php | |
add_filter( 'excerpt_length', function($length) { | |
return 20; //edit the number to the amount of words you want to show in your excerpts | |
}, PHP_INT_MAX ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this code into your theme functions.php file | |
//step 1: change the admin login logo to the uploaded media image file | |
if ( !function_exists('tt_wp_admin_login_logo') ) : | |
function tt_wp_admin_login_logo() { ?> | |
<style type="text/css"> | |
body.login div#login h1 a { | |
background-image: url('https://www.yoursite.com/wp-content/uploads/2022/09/your-logo.jpg'); |
OlderNewer