Skip to content

Internal price-log CPT unnecessarily registers rewrite rules and query variable #46

Description

@ignacyhologa

The plugin registers its internal price-log post type without arguments:

register_post_type( $this->post_type_name );
WordPress consequently applies default values including:
'rewrite' => true,
'query_var' => true,

Although the resulting CPT is non-public and used only as internal storage, WordPress generates approximately 25 frontend rewrite rules under:
iw_omnibus_price_log/*

Multilingual plugins such as WPML also detect this rewrite slug and register an unnecessary URL slug: iw_omnibus_price_log translation string.
Suggested registration:

register_post_type(
	$this->post_type_name,
	[
		'public'              => false,
		'publicly_queryable'  => false,
		'exclude_from_search' => true,
		'show_ui'             => false,
		'show_in_rest'        => false,
		'rewrite'             => false,
		'query_var'           => false,
		'can_export'          => false,
	]
);

Internal WP_Query calls using post_type => iw_omnibus_price_log continue working with these settings.
Observed with Omnibus on WordPress:
over 57,000 internal log posts,
about 25 unnecessary rewrite rules,
unnecessary WPML slug registration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions