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 | |
// This code snippet forces a new created user to change his password on first login | |
// To identify if a user changed his password we'll add an user meta key named password-changed when a user changes his password | |
// A new created user does not have this meta - so we know, he has to changed his password yet | |
// To force an user again to change his password we'd only have to delete the meta key | |
// Add a custom function to current_screen which is an admin hook triggered after the necessary elements to identify a screen are set up | |
add_action( 'current_screen', 'check_password_changed' ); |
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
<div class="container"> | |
<div id="primary"> | |
<div id="content"> | |
<?php | |
$pp404 = false; |
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 | |
// This code snippet prevents WordPress from giving hints on incorrect logins | |
// Add a custom function to filter the login error message | |
add_filter( 'login_errors', 'hide_login_hint' ); | |
function hide_login_hint( $error ){ | |
// No matter what error occurred always display the same message | |
return 'Login incorrect.'; | |
} |
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 | |
// This code snippet uses the first paragraph of an article as excerpt | |
// use an anonymous function to filter the excerpt | |
// this changes the behavior of the function the_excerpt() to use the first paragraph | |
add_filter( 'wp_trim_excerpt', function( $text, $raw_excerpt ) { | |
$content = apply_filters( 'the_content', get_the_content() ); | |
return substr( $content, 0, strpos( $content, '</p>' ) + 4 ); | |
} ), 10, 2 ); | |
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
define('DISABLE_WP_CRON', 'true'); |
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
@media screen and (min-width: 56.875em) { | |
.site-main { | |
-moz-column-count: 2; | |
-webkit-column-count: 2; | |
column-count: 2; | |
} | |
.site-main h1 { | |
-moz-column-span: all; | |
-webkit-column-span: all; | |
column-span: all; |
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 | |
// This code snippet adds additional file types allowed to upload | |
// Add a custom function to add needed mime types | |
add_filter( 'upload_mimes', 'add_mime_types' ); | |
function add_mime_types( $mime_types ) { | |
// add file extensions .svg, .webp, .ai, .eps, .ep, .xml | |
// more file extensions can be added just the same |
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 | |
// This code snippet disables the URL autocorrection guessing feature of WordPress | |
// Add a custom function to disable autocorrection guessing | |
add_filter( 'redirect_canonical', 'stop_url_autocorrect' ); | |
function stop_url_autocorrect( $redirect_url ) { | |
if ( is_404() && !isset( $_GET['p'] ) ) { | |
$redirect_url = false; | |
} |
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 | |
// This code snippet removes the "Screen Options" Tab from the top right corner of the WordPress Admin | |
add_filter( 'screen_options_show_screen', '__return_false' ); | |
?> |
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 | |
// This code snippet forces login with email address and eliminates login with user name | |
// Remove the default authentication function and replace it by a custom function | |
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 ); | |
add_filter( 'authenticate', 'force_email_login', 20, 3 ); | |
// Custom function to force email login | |
function force_email_login( $user, $username, $password ) { |
NewerOlder