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
//Disables the Gutenberg editor and brings back the WYSIWYG editor. | |
add_filter('use_block_editor_for_post', '__return_false', 10); |
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 /* Disables All comments */ | |
add_action('admin_init', function () { | |
// Redirect any user trying to access comments page | |
global $pagenow; | |
if ($pagenow === 'edit-comments.php') { | |
wp_redirect(admin_url()); | |
exit; | |
} |
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
*~ | |
.DS_Store | |
.svn | |
.cvs | |
*.bak | |
*.swp | |
Thumbs.db | |
.htaccess | |
.vscode/ |
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 | |
function is_valid_email_domain($login, $email, $errors ){ | |
$valid_email_domains = array("ocre.com.au","stafflink.com.au");// whitelist email domain lists | |
$valid = false; | |
foreach( $valid_email_domains as $d ){ | |
$d_length = strlen( $d ); | |
$current_email_domain = strtolower( substr( $email, -($d_length), $d_length)); | |
if( $current_email_domain == strtolower($d) ){ | |
$valid = true; | |
break; |
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 | |
// Stop Authors from accessing the admin dashboard unless you are an admin. | |
function prevent_author_access(){ | |
if( current_user_can( 'author' ) && is_admin() ) { | |
// do something here. maybe redirect to homepage | |
wp_safe_redirect( get_bloginfo( 'url' ) ); | |
} | |
} | |
add_action( 'admin_init', 'prevent_author_access' ); |
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 | |
/** | |
* Display the user goals form on the front end using a shortcode. | |
* | |
* @since 1.0.0 | |
*/ | |
function stafflink_user_goals( $atts ) { | |
$a = shortcode_atts( array( |
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 | |
/** | |
* Change logo and branding of the WordPress login page. | |
* Replace the background Image URL CSS element to update the image. | |
* Ensure you have a file called style-login.css in the root directory of your child theme. | |
* | |
* @since 1.0.0 | |
*/ | |
function my_login_logo() { | |
echo ' |
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 | |
/** | |
* Check to ensure the users' email address matches the allowed list. | |
* Update the $valid_email_domains array to a comma separated list of string email addresses. | |
* | |
* @since 1.0.0 | |
*/ | |
function is_valid_email_domain($login, $email, $errors ) { | |
$valid_email_domains = array("imageproperty.com.au","stafflink.com.au");// whitelist email domain lists |
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
<?hp | |
/** | |
* Assign the user to their selected groups. Comment out what is not used where possible. | |
* usage: ld_update_group_access('Id of user (found in $user_id), 'id of group:bool (enter manually after creating group', false); | |
* $entry[7] is the form line 7. In this case, it is a single select drop down. | |
* | |
* @since 1.0.0 | |
*/ | |
add_action( 'gform_user_registered', 'update_user_groups', 10, 4 ); |
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 | |
/** | |
* Bypass Force Login to allow for exceptions. Used to push everyone to the login page, except if they are registering. | |
* As it stands, this code allows the forcelogin plugin to ignores /register. | |
* | |
* @param bool $bypass Whether to disable Force Login. Default false. | |
* @param string $visited_url The visited URL. | |
* @return bool | |
*/ |
OlderNewer