WC_Admin_Post_Types
in package
WC_Admin_Post_Types Class.
Handles the edit posts views and some functionality on the edit post screen for WC post types.
Table of Contents
- __construct() : mixed
- Constructor.
- add_display_post_states() : mixed
- Add a post display state for special WC pages in the page list table.
- bulk_and_quick_edit_hook() : mixed
- Offers a way to hook into save post without causing an infinite loop when quick/bulk saving product info.
- bulk_and_quick_edit_save_post() : int
- Quick and bulk edit saving.
- bulk_edit() : mixed
- Custom bulk edit - form.
- bulk_edit_save() : mixed
- Bulk edit.
- bulk_post_updated_messages() : array<string|int, mixed>
- Specify custom bulk actions messages for different post types.
- disable_autosave() : mixed
- Disable the auto-save functionality for Orders.
- edit_form_after_title() : mixed
- Print coupon description textarea field.
- edit_form_top() : mixed
- Output extra data on post forms.
- enter_title_here() : string
- Change title boxes in admin.
- hidden_meta_boxes() : array<string|int, mixed>
- Hidden default Meta-Boxes.
- hide_cpt_archive_templates() : array<string|int, mixed>
- When editing the shop page, we should hide templates.
- order_updated_messages() : array<string|int, mixed>
- Add messages when an order is updated.
- post_updated_messages() : array<string|int, mixed>
- Change messages when a post type is updated.
- process_product_file_download_paths() : mixed
- Grant downloadable file access to any newly added files on any existing.
- product_data_visibility() : mixed
- Output product visibility options.
- quick_edit() : mixed
- Custom quick edit - form.
- setup_screen() : mixed
- Looks at the current screen and loads the correct list table handler.
- show_cpt_archive_notice() : mixed
- Show a notice above the CPT archive.
- request_data() : array<string|int, mixed>
- Get the current request data ($_REQUEST superglobal).
- maybe_update_stock_status() : WC_Product
- Apply product type constraints to stock status.
- quick_edit_save() : mixed
- Quick edit.
- set_new_price() : bool
- Set the new regular or sale price if requested.
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —add_display_post_states()
Add a post display state for special WC pages in the page list table.
public
add_display_post_states(array<string|int, mixed> $post_states, WP_Post $post) : mixed
Parameters
- $post_states : array<string|int, mixed>
-
An array of post display states.
- $post : WP_Post
-
The current post object.
Return values
mixed —bulk_and_quick_edit_hook()
Offers a way to hook into save post without causing an infinite loop when quick/bulk saving product info.
public
bulk_and_quick_edit_hook(int $post_id, object $post) : mixed
Parameters
- $post_id : int
-
Post ID being saved.
- $post : object
-
Post object being saved.
Tags
Return values
mixed —bulk_and_quick_edit_save_post()
Quick and bulk edit saving.
public
bulk_and_quick_edit_save_post(int $post_id, object $post) : int
Parameters
- $post_id : int
-
Post ID being saved.
- $post : object
-
Post object being saved.
Return values
int —bulk_edit()
Custom bulk edit - form.
public
bulk_edit(string $column_name, string $post_type) : mixed
Parameters
- $column_name : string
-
Column being shown.
- $post_type : string
-
Post type being shown.
Return values
mixed —bulk_edit_save()
Bulk edit.
public
bulk_edit_save(int $post_id, WC_Product $product) : mixed
Parameters
- $post_id : int
-
Post ID being saved.
- $product : WC_Product
-
Product object.
Return values
mixed —bulk_post_updated_messages()
Specify custom bulk actions messages for different post types.
public
bulk_post_updated_messages(array<string|int, mixed> $bulk_messages, array<string|int, mixed> $bulk_counts) : array<string|int, mixed>
Parameters
- $bulk_messages : array<string|int, mixed>
-
Array of messages.
- $bulk_counts : array<string|int, mixed>
-
Array of how many objects were updated.
Return values
array<string|int, mixed> —disable_autosave()
Disable the auto-save functionality for Orders.
public
disable_autosave() : mixed
Return values
mixed —edit_form_after_title()
Print coupon description textarea field.
public
edit_form_after_title(WP_Post $post) : mixed
Parameters
- $post : WP_Post
-
Current post object.
Return values
mixed —edit_form_top()
Output extra data on post forms.
public
edit_form_top(WP_Post $post) : mixed
Parameters
- $post : WP_Post
-
Current post object.
Return values
mixed —enter_title_here()
Change title boxes in admin.
public
enter_title_here(string $text, WP_Post $post) : string
Parameters
- $text : string
-
Text to shown.
- $post : WP_Post
-
Current post object.
Return values
string —hidden_meta_boxes()
Hidden default Meta-Boxes.
public
hidden_meta_boxes(array<string|int, mixed> $hidden, object $screen) : array<string|int, mixed>
Parameters
- $hidden : array<string|int, mixed>
-
Hidden boxes.
- $screen : object
-
Current screen.
Return values
array<string|int, mixed> —hide_cpt_archive_templates()
When editing the shop page, we should hide templates.
public
hide_cpt_archive_templates(array<string|int, mixed> $page_templates, string $theme, WP_Post $post) : array<string|int, mixed>
Parameters
- $page_templates : array<string|int, mixed>
-
Templates array.
- $theme : string
-
Classname.
- $post : WP_Post
-
The current post object.
Return values
array<string|int, mixed> —order_updated_messages()
Add messages when an order is updated.
public
order_updated_messages(array<string|int, mixed> $messages) : array<string|int, mixed>
Parameters
- $messages : array<string|int, mixed>
-
Array of messages.
Return values
array<string|int, mixed> —post_updated_messages()
Change messages when a post type is updated.
public
post_updated_messages(array<string|int, mixed> $messages) : array<string|int, mixed>
Parameters
- $messages : array<string|int, mixed>
-
Array of messages.
Return values
array<string|int, mixed> —process_product_file_download_paths()
Grant downloadable file access to any newly added files on any existing.
public
process_product_file_download_paths(int $product_id, int $variation_id, array<string|int, mixed> $downloadable_files) : mixed
orders for this product that have previously been granted downloadable file access.
Parameters
- $product_id : int
-
product identifier.
- $variation_id : int
-
optional product variation identifier.
- $downloadable_files : array<string|int, mixed>
-
newly set files.
Tags
Return values
mixed —product_data_visibility()
Output product visibility options.
public
product_data_visibility() : mixed
Return values
mixed —quick_edit()
Custom quick edit - form.
public
quick_edit(string $column_name, string $post_type) : mixed
Parameters
- $column_name : string
-
Column being shown.
- $post_type : string
-
Post type being shown.
Return values
mixed —setup_screen()
Looks at the current screen and loads the correct list table handler.
public
setup_screen() : mixed
Tags
Return values
mixed —show_cpt_archive_notice()
Show a notice above the CPT archive.
public
show_cpt_archive_notice(WP_Post $post) : mixed
Parameters
- $post : WP_Post
-
The current post object.
Return values
mixed —request_data()
Get the current request data ($_REQUEST superglobal).
protected
request_data() : array<string|int, mixed>
This method is added to ease unit testing.
Return values
array<string|int, mixed> — The $_REQUEST superglobal.maybe_update_stock_status()
Apply product type constraints to stock status.
private
maybe_update_stock_status(WC_Product $product, string|null $stock_status) : WC_Product
Parameters
- $product : WC_Product
-
The product whose stock status will be adjusted.
- $stock_status : string|null
-
The stock status to use for adjustment, or null if no new stock status has been supplied in the request.
Return values
WC_Product — The supplied product, or the synced product if it was a variable product.quick_edit_save()
Quick edit.
private
quick_edit_save(int $post_id, WC_Product $product) : mixed
Parameters
- $post_id : int
-
Post ID being saved.
- $product : WC_Product
-
Product object.
Return values
mixed —set_new_price()
Set the new regular or sale price if requested.
private
set_new_price(WC_Product $product, string $price_type) : bool
Parameters
- $product : WC_Product
-
The product to set the new price for.
- $price_type : string
-
'regular' or 'sale'.