那么使用wp_set_post_tags()
(Codex ref) 修改标记的数量,然后将其连接到save_post
或publish_post
或任何适当的地方?
e、 g。
function mytheme_limit_post_tags( $post_id ) {
// code to count/limit the number of tags
// then pass the modified list of tags to wp_set_post_tags
wp_set_post_tags( $post_id, $tags, false );
}
add_action( \'publish_post\', \'mytheme_limit_post_tags\' );