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 | |
// Removes the Yoast Metabox for Roles other then Admins | |
// Returns true if user has specific role | |
function check_user_role( $role, $user_id = null ) { | |
if ( is_numeric( $user_id ) ) | |
$user = get_userdata( $user_id ); | |
else | |
$user = wp_get_current_user(); | |
if ( empty( $user ) ) | |
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 | |
//-----------------------// | |
// Disable Visual Editor // | |
//-----------------------// | |
add_filter( 'user_can_richedit', function ( $default ) { | |
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 | |
//-------------------------------------------------// | |
// Disable Auto <p> Tag Around <img> in ACF Fields // | |
//-------------------------------------------------// | |
function img_unautop($pee) { | |
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '$1', $pee); | |
return $pee; | |
} | |
add_filter( 'acf_the_content', 'img_unautop', 30 ); |
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 | |
//----------------------------// | |
// Customize WP Auto <p> Tags // | |
//----------------------------// | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'custom_wpautop' ); | |
function custom_wpautop($pee, $br = true) { | |
$pre_tags = 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 | |
//---------------------------------------------------// | |
// Removes noreferrer from your new or updated posts // | |
//---------------------------------------------------// | |
add_filter( 'wp_targeted_link_rel', 'my_targeted_link_rel_remove_noreferrer',999); | |
function my_targeted_link_rel_remove_noreferrer( $rel_values ) { | |
return preg_replace( '/noreferrer\s*/i', '', $rel_values ); | |
} |
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 | |
//---------------------------// | |
// Redirect CPT Page to Home // | |
//---------------------------// | |
add_action( 'template_redirect', function() { | |
if ( is_singular('doctors') || is_singular('programs') ) { | |
global $post; | |
$redirectLink = get_home_url(); | |
wp_redirect( $redirectLink, 302 ); |
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 | |
//-------------------------------// | |
// Removes comment functionality // | |
//-------------------------------// | |
// Removes from admin menu | |
function my_remove_admin_menus() { | |
remove_menu_page( 'edit-comments.php' ); | |
} | |
add_action( 'admin_menu', 'my_remove_admin_menus' ); |
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 HTML Editor Syntax Highlighter to ACF WYSIWYG // | |
//---------------------------------------------------// | |
/* ADD CODE MIRROR CSS */ | |
function admin_style() { | |
wp_enqueue_style('admin-styles', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/codemirror.css'); | |
} | |
add_action('admin_enqueue_scripts', 'admin_style'); |
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 | |
//--------------------------------// | |
// Remove Unnecessary Header Code // | |
//--------------------------------// | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wp_shortlink_wp_head'); | |
remove_action('wp_head', 'print_emoji_detection_script', 7 ); |
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 | |
//------------------// | |
// Remove WP Jquery // | |
//------------------// | |
function change_default_jquery( ){ | |
wp_dequeue_script( 'jquery'); | |
wp_deregister_script( 'jquery'); | |
} | |
add_filter( 'wp_enqueue_scripts', 'change_default_jquery', PHP_INT_MAX ); |