我使用一个插件创建一个自定义的帖子类型,其中包含一个我想要更改的slug。我不想覆盖插件文件,所以我想知道如何使用单独的函数更改slug?谢谢
// Register post type
add_action( \'init\', \'ctc_register_post_type_item\' );
function ctc_register_post_type_item() {
// Arguments
$args = array(
\'labels\' => array(
\'name\' => _x( \'items\', \'post type general name\', \'church-theme-content\' ),
\'singular_name\' => _x( \'item\', \'post type singular name\', \'church-theme-content\' ),
\'add_new\' => _x( \'Add New\', \'item\', \'church-theme-content\' ),
\'add_new_item\' => __( \'Add Item\', \'church-theme-content\' ),
\'edit_item\' => __( \'Edit Item\', \'church-theme-content\' ),
\'new_item\' => __( \'New Item\', \'church-theme-content\' ),
\'all_items\' => __( \'All Items\', \'church-theme-content\' ),
\'view_item\' => __( \'View Item\', \'church-theme-content\' ),
\'search_items\' => __( \'Search Items\', \'church-theme-content\' ),
\'not_found\' => __( \'No items found\', \'church-theme-content\' ),
\'not_found_in_trash\' => __( \'No items found in Trash\', \'church-theme-content\' )
),
\'public\' => ctc_feature_supported( \'items\' ),
\'has_archive\' => ctc_feature_supported( \'items\' ),
\'rewrite\' => array(
\'slug\' => \'items\',
\'with_front\' => false,
\'feeds\' => ctc_feature_supported( \'items\' )
),
\'supports\' => array( \'title\', \'editor\', \'excerpt\', \'publicize\', \'thumbnail\', \'comments\', \'author\', \'revisions\' ), // \'editor\' required for media upload button (see Meta Boxes note below about hiding)
\'taxonomies\' => array( \'ctc_item_topic\', \'ctc_item_book\', \'ctc_item_series\', \'ctc_item_speaker\', \'ctc_item_tag\' ),
\'menu_icon\' => \'dashicons-video-alt3\'
);
$args = apply_filters( \'ctc_post_type_item_args\', $args ); // allow filtering
// Registration
register_post_type(
\'ctc_item\',
$args
);
}