Looking at the class and function you’re using, this method is a little problematic:
public function buildPostArgs( $slug, $singular="Post", $plural="Posts", $args = array() )
{
$args = wp_parse_args($args, $this->postDefaults);
$args['rewrite']['slug'] = $slug;
$args['labels'] = $this->buildPostLabels($singular, $plural);
return $args;
}
If we ignore your problem, $args['rewrite']['slug']
is going to generate a PHP warning if you set rewrite
to false for trying to use it as an array.
So if we separate out the call into a variable like this:
$args = theme_build_post_args(
// $slug, $singular, $plural
'integrations', 'Integration', 'Integrations',
[
'menu_position' => 21,
'hierarchical' => false,
'supports' => array('title', 'revisions'),
'taxonomies' => array('categories'),
]
);
register_post_type(
'Integrations',
$args
);
We can now overwrite what your helper did, e.g.
$args = theme_build_post_args(
// $slug, $singular, $plural
'integrations', 'Integration', 'Integrations',
[
'menu_position' => 21,
'hierarchical' => false,
'supports' => array('title', 'revisions'),
'taxonomies' => array('categories'),
]
);
$args['public'] = false;
... etc ...
register_post_type(
'Integrations',
$args
);
In particular look at what it defines in $postDefaults
and override those specifically to match what you want.
You might also want to ditch the function and just use the label setup parts to simplify things:
$builder = new theme_PTTaxArgBuilder;
$args = [
'labels' => $builder->buildPostLabels( 'Integration', 'Integrations' ),
'menu_position' => 21,
'hierarchical' => false,
'supports' => array('title', 'revisions'),
'taxonomies' => array('categories'),
'public' => false,
'show_ui' => true,
];
register_post_type(
'Integrations',
$args
);