Closed LevelUpGit closed 3 hours ago
@LevelUpGit
As of now, has_archive in JetEngine post types can be a bool only, and it is consistent with register_post_type() arguments:
has_archive bool|string Whether there should be post type archives, or if a string, the archive slug to use
You are totally safe using the filter to modify this argument as you need.
If more people will need this feature, we will change the type of argument to string with a default value of post type slug, and empty value treated as false. Otherwise, the things will stay as they are now - not to break anything.
I hope it is not too inconvenient to use the code for now.
It's great to hear it is safe to use, thank you. We hope it will be included in plugin, as everything need plural/singlular form.
Hi, we are having premalink issue with setting slug for plural (archive) and for single. We need to set different slugs for the archive and single posts. WordPress allows this, but JetEngine doesn’t have the ability to set the archive slug; it only has an option for the single post. If we extend it with custom code it works, but we don't know what effect will it have on rest of the plugin.
Cutom code we used to extend already made cpt:
function modify_slug_article($args, $post_type) { if ('articles' === $post_type) { $args['has_archive'] = 'articles'; $args['rewrite'] = array('slug' => 'article'); } return $args; } add_filter('register_post_type_args', 'modify_slug_article', 10, 2);