WC_Post_Types
in package
Post types Class.
Table of Contents
- flush_rewrite_rules() : mixed
- Flush rewrite rules.
- gutenberg_can_edit_post_type() : bool
- Disable Gutenberg for products.
- init() : mixed
- Hook in methods.
- maybe_flush_rewrite_rules() : mixed
- Flush rules if the event is queued.
- register_post_status() : mixed
- Register our custom post statuses, used for order status.
- register_post_types() : mixed
- Register core post types.
- register_taxonomies() : mixed
- Register core taxonomies.
- rest_api_allowed_post_types() : array<string|int, mixed>
- Added product for Jetpack related posts.
- support_jetpack_omnisearch() : mixed
- Add Product Support to Jetpack Omnisearch.
- updated_term_messages() : bool
- Customize taxonomies update messages.
- queue_rewrite_rules_on_shop_page_save() : void
- Queue rewrite rules to be flushed after the shop page (or its ancestors) gets saved.
- should_register_product_archive() : bool
- Resolve theme support used to register the product archive.
- wp_cli_skips_active_theme() : bool
- Determine whether WP-CLI skipped the active theme.
Methods
flush_rewrite_rules()
Flush rewrite rules.
public
static flush_rewrite_rules() : mixed
While WordPress is installing, the registration graph can be incomplete because themes and regular plugins may not be loaded, so flushing now would persist rules that are missing third-party post types, taxonomies, and the product archive. Queue the flush instead and let the next normal request regenerate the rules from a complete graph.
Return values
mixed —gutenberg_can_edit_post_type()
Disable Gutenberg for products.
public
static gutenberg_can_edit_post_type(bool $can_edit, string $post_type) : bool
Parameters
- $can_edit : bool
-
Whether the post type can be edited or not.
- $post_type : string
-
The post type being checked.
Return values
bool —init()
Hook in methods.
public
static init() : mixed
Return values
mixed —maybe_flush_rewrite_rules()
Flush rules if the event is queued.
public
static maybe_flush_rewrite_rules() : mixed
Consuming the queue regenerates and persists the whole rewrite graph. A request that skips
the active theme would write the theme's rules away with nothing left to retry, so it
leaves the queue for the next normal request. This mirrors the $theme_unavailable check
in register_post_types().
Tags
Return values
mixed —register_post_status()
Register our custom post statuses, used for order status.
public
static register_post_status() : mixed
Return values
mixed —register_post_types()
Register core post types.
public
static register_post_types() : mixed
Return values
mixed —register_taxonomies()
Register core taxonomies.
public
static register_taxonomies() : mixed
Return values
mixed —rest_api_allowed_post_types()
Added product for Jetpack related posts.
public
static rest_api_allowed_post_types(array<string|int, mixed> $post_types) : array<string|int, mixed>
Parameters
- $post_types : array<string|int, mixed>
-
Post types.
Return values
array<string|int, mixed> —support_jetpack_omnisearch()
Add Product Support to Jetpack Omnisearch.
public
static support_jetpack_omnisearch() : mixed
Return values
mixed —updated_term_messages()
Customize taxonomies update messages.
public
static updated_term_messages(array<string|int, mixed> $messages) : bool
Parameters
- $messages : array<string|int, mixed>
-
The list of available messages.
Tags
Return values
bool —queue_rewrite_rules_on_shop_page_save()
Queue rewrite rules to be flushed after the shop page (or its ancestors) gets saved.
private
static queue_rewrite_rules_on_shop_page_save(int $post_id[, WP_Post|null $post = null ]) : void
Parameters
- $post_id : int
-
Post ID.
- $post : WP_Post|null = null
-
Post object.
Return values
void —should_register_product_archive()
Resolve theme support used to register the product archive.
private
static should_register_product_archive(bool $theme_support, bool $theme_unavailable) : bool
Parameters
- $theme_support : bool
-
Whether the current request reports theme support.
- $theme_unavailable : bool
-
Whether the active theme may not be loaded on this request.
Return values
bool —wp_cli_skips_active_theme()
Determine whether WP-CLI skipped the active theme.
private
static wp_cli_skips_active_theme() : bool
