• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

関数リファレンス/unregister sidebar

提供: WordPress Codex 日本語版
< 関数リファレンス
2015年7月23日 (木) 12:12時点におけるMiccweb (トーク | 投稿記録)による版 (ページの作成:「== Description == De-registers a previously registered sidebar. == Usage == %%% <?php unregister_sidebar( $id ); ?> %%% == Parameters == {{Parameter|$id|...」)

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Description

De-registers a previously registered sidebar.

Usage

%%% <?php unregister_sidebar( $id ); ?> %%%

Parameters

$id
string) (必須) The ID of the sidebar when it was added.
初期値: なし

Example

If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.

function remove_some_widgets(){

	// Unregister some of the TwentyTen sidebars
	unregister_sidebar( 'first-footer-widget-area' );
	unregister_sidebar( 'second-footer-widget-area' );
	unregister_sidebar( 'third-footer-widget-area' );
	unregister_sidebar( 'fourth-footer-widget-area' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );

Notes

In the example, note that we assign a priority of 11 when registering the widgets_init hook. This is because a child theme's functions.php file is called before the parent theme's, which means that our call to unregister_sidebar() would accomplish nothing since the sidebar has not yet been registered.

By lowering the priority of our action, we ensure that it is called after the parent theme's functions.php file is loaded.

Change Log

Since: 2.2.0

Source File

unregister_sidebar() is located in wp-includes/widgets.php.

Related

サイドバー: is_active_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), wp_register_sidebar_widget() / en, wp_unregister_sidebar_widget() / en, wp_get_sidebars_widgets() / en, wp_set_sidebars_widgets() / en,



関数リファレンステンプレートタグ目次もご覧ください。