функция
since 2.6.0
post_categories_meta_box()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
post_categories_meta_box( WP_Post $post, array $box )
Описание
Отображает поля формы рубрик записи.
Параметры
$post
WP_Post
обязательный
Текущий объект записи.
$box
array
обязательный
Categories meta box arguments.
id stringMeta box 'id' attribute.
title stringMeta box title.
callback callableMeta box display callback.
args array Extra meta box arguments.
taxonomy stringTaxonomy. Default 'category'.
Source function post_categories_meta_box( $post, $box ) {
$defaults = array( 'taxonomy' => 'category' );
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
$args = array();
} else {
$args = $box['args'];
}
$parsed_args = wp_parse_args( $args, $defaults );
$tax_name = esc_attr( $parsed_args['taxonomy'] );
$taxonomy = get_taxonomy( $parsed_args['taxonomy'] );
?>
<div id="taxonomy-" class="categorydiv">
<ul id="-tabs" class="category-tabs" role="tablist">
<a href="#-all" role="tab" aria-selected="true" aria-controls="-all">labels->all_items; ?>
<div id="-pop" class="tabs-panel" style="display: none;" role="tabpanel">
<ul id="checklist-pop" class="categorychecklist form-no-clear" >
<div id="-all" class="tabs-panel" role="tabpanel">
<?php
$name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
// Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks.
echo "";
?>
<ul id="checklist" data-wp-lists="list:" class="categorychecklist form-no-clear">
ID,
array(
'taxonomy' => $tax_name,
'popular_cats' => $popular_ids,
)
);
?>

