Last active
February 9, 2025 22:04
-
-
Save tomdevisser/5b6f8959346dd0f62400c2d7bc3fdcc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Displays a custom taxonomy meta box without adder. | |
* | |
* @param WP_Post $post Current post object. | |
* @param array $box Categories meta box arguments. | |
* @return void | |
*/ | |
function toms_custom_meta_box_without_adder( WP_Post $post, array $box ): void { | |
$tax_name = esc_attr( $box['args']['taxonomy'] ); | |
?> | |
<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv toms-custom-meta-box"> | |
<?php echo "<input type='hidden' name='tax_input[' . $tax_name . ']' value='0' />"; ?> | |
<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> | |
<?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name ) ); ?> | |
</ul> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment