43 lines
1 KiB
PHP
43 lines
1 KiB
PHP
<?php
|
|
/***
|
|
* Removal of all unwanted features
|
|
*
|
|
* @package EcoWP\Functions\Cleanup
|
|
* @since 0.1
|
|
*/
|
|
|
|
/***
|
|
* Hook on init to remove some supports and functionalities
|
|
*
|
|
*/
|
|
add_action( 'init',function(){
|
|
// Remove tag for posts
|
|
unregister_taxonomy_for_object_type( 'post_tag', 'post' );
|
|
|
|
// Remove unwanted supports
|
|
remove_post_type_support('post', 'author');
|
|
remove_post_type_support('page', 'author');
|
|
remove_post_type_support('post', 'comments');
|
|
remove_post_type_support('page', 'comments');
|
|
remove_post_type_support('post', 'trackbacks');
|
|
remove_post_type_support('page', 'trackbacks');
|
|
});
|
|
|
|
// Removal of pre-made patterns
|
|
remove_theme_support( 'core-block-patterns' );
|
|
|
|
/***
|
|
* Removal of search feature
|
|
*
|
|
*/
|
|
function matt_filter_query( $query, $error = true ) {
|
|
if ( is_search() ) {
|
|
$query->is_search = false;
|
|
$query->query_vars['s'] = false;
|
|
$query->query['s'] = false;
|
|
if ( $error )
|
|
$query->is_404 = true;
|
|
}
|
|
}
|
|
add_action( 'parse_query', 'matt_filter_query' );
|
|
add_filter( 'get_search_form', function () { return null; } ); |