remove_theme_support()
最后更新于:2021-11-27 21:45:33
remove_theme_support( string$feature)Allows a theme to de-register its support of a certain feature
参数
- $feature
-
(string) (Required) The feature being removed. See add_theme_support() for the list of possible values.
响应
(bool|void) Whether feature was removed.
源文件
文件: gc-includes/theme.php
function remove_theme_support( $feature ) {
// Do not remove internal registrations that are not used directly by themes.
if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ), true ) ) {
return false;
}
return _remove_theme_support( $feature );
}
// in your Child Theme's functions.php // Use the after_setup_theme hook with a priority of 11 to load after the // parent theme, which will fire on the default priority of 10 add_action( 'after_setup_theme', 'remove_featured_images_from_child_theme', 11 ); function remove_featured_images_from_child_theme() { // This will remove support for post thumbnails on ALL Post Types remove_theme_support( 'post-thumbnails' ); // Add this line in to re-enable support for just Posts add_theme_support( 'post-thumbnails', array( 'post' ) ); }