最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

save post - Custom taxonomy only gets saved in quick edit

programmeradmin1浏览0评论

I have set up 2 custom taxonomies for my posts: verdicts and sponsors.

The problem is that sponsors do not get saved when publishing a post, it can only get saved when I check it in quick edit mode.

The code for my custom taxonomy is pretty basic, as you can see below.

Does anyone have any idea? Thanks!

<?php 
// Register Custom Taxonomy
function custom_sponsors() {

    $labels = array(
        'name'              => _x( 'Sponsors', 'Taxonomy General Name', 'text_domain' ),
        // the rest of labels
    );
    $rewrite = array(
        'slug'              => 'sponsor',
        'with_front'        => true,
        'hierarchical'      => true,
    );
    $args2 = array(
        'labels'            => $labels,
        'hierarchical'      => true,
        'public'            => true,
        'show_ui'           => true,
        'show_admin_column' => true,
        'show_in_nav_menus' => true,
        'show_tagcloud'     => false,
        'query_var'         => 'sponsor',
        'rewrite'           => $rewrite,
    );
    register_taxonomy( 'sponsor', array( 'post' ), $args2 );
}

// Hook into the 'init' action
add_action( 'init', 'custom_sponsors', 0 );
发布评论

评论列表(0)

  1. 暂无评论