Remove Query Strings From Static Files

function wpcode_snippet_remove_query_strings_split( $src ) { $output = preg_split( “/(&ver|\?ver)/”, $src ); return $output ? $output[0] : ”; } add_action( ‘init’, function () { if ( ! is_admin() ) { add_filter( ‘script_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); add_filter( ‘style_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); }…Continue reading

Exclude Posts & Pages from Search

/** * Exclude Post Type from Search */ add_action(‘init’, ‘excludePostTypeFromSearch’, 99); function excludePostTypeFromSearch(){ global $wp_post_types; if(post_type_exists(‘post’) && isset($wp_post_types[‘post’])){ $wp_post_types[‘post’]->exclude_from_search = true; } if(post_type_exists(‘page’) && isset($wp_post_types[‘page’])){ $wp_post_types[‘page’]->exclude_from_search = true; } }Continue reading