remove_theme_support()禁止/删除主题功能支持

目录

描述

Allows a theme to de-register its support of a certain theme feature. Should be called in the theme's functions.php file. Generally would be used for child themes to override support from the parent theme.

remove_theme_support() 描述

用法

<?php remove_theme_support$feature ); ?>

remove_theme_support() 用法

参数

$feature

(string) (必填) Name for the feature being removed.

Features list:

  • 'post-formats'
  • 'post-thumbnails'
  • 'custom-background'
  • 'custom-header'
  • 'automatic-feed-links'
  • 'html5'
  • 'title-tag'
  • 'menus'

默认值: None

remove_theme_support() 参数

返回值

(boolean

Returns true if feature was removed, false otherwise.

remove_theme_support() 返回值

示例

Removing a Feature In a Child Theme

In some cases, a Parent Theme may have activated a feature that you do not want to have available in your Child Theme. For instance, if you are using a parent theme that has activated Featured Images for all Pages and Posts, but you'd like to remove the functionality of having Featured Images for Pages in your Child Theme, you could do something like this:

remove_theme_support() 示例

历史

  • 添加于 版本: 3.1.0

remove_theme_support() 历史

源文件

remove_theme_support() 函数的代码位于 wp-includes/theme.php.

remove_theme_support() 源文件

相关