PHP Class WC_Admin_Post_Types

Handles the edit posts views and some functionality on the edit post screen for WC post types.
Mostra file Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor.
add_custom_query_var ( mixed $public_query_vars ) : array Query vars for custom searches.
bulk_action ( ) Process the new bulk actions for changing order status.
bulk_admin_footer ( ) Add extra bulk action options to mark orders as complete or processing.
bulk_admin_notices ( ) Show confirmation message that order status changed for number of orders.
bulk_and_quick_edit_hook ( integer $post_id, object $post ) 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 ( integer $post_id, WP_Post $post ) : integer Quick and bulk edit saving.
bulk_edit ( mixed $column_name, mixed $post_type ) Custom bulk edit - form.
bulk_edit_save ( integer $post_id, WC_Product $product ) Bulk edit.
bulk_post_updated_messages ( array $bulk_messages, array $bulk_counts ) : array Specify custom bulk actions messages for different post types.
disable_autosave ( ) Disable the auto-save functionality for Orders.
disable_dfw_feature_pointer ( ) Disable DFW feature pointer.
disable_view_mode_options ( array $post_types ) : array Removes products, orders, and coupons from the list of post types that support "View Mode" switching.
edit_form_after_title ( WP_Post $post ) Print coupon description textarea field.
enter_title_here ( string $text, object $post ) : string Change title boxes in admin.
handle_shop_order_bulk_actions ( string $redirect_to, string $action, array $ids ) : string Handle shop order bulk actions.
hidden_meta_boxes ( array $hidden, object $screen ) : array Hidden default Meta-Boxes.
hide_cpt_archive_templates ( $page_templates, $class, $post ) : array When editing the shop page, we should hide templates.
list_table_primary_column ( string $default, string $screen_id ) : string Set list table primary column for products and orders.
maybe_render_blank_state ( $which ) Show blank slate.
post_updated_messages ( array $messages ) : array Change messages when a post type is updated.
process_product_file_download_paths ( integer $product_id, integer $variation_id, array $downloadable_files ) Grant downloadable file access to any newly added files on any existing.
product_columns ( array $existing_columns ) : array Define custom columns for products.
product_data_visibility ( ) Output product visibility options.
product_filters ( ) Show a category filter box.
product_filters_query ( mixed $query ) Filter the products in admin based on options.
product_search ( string $where ) : string Search by SKU or ID for products.
product_sortable_columns ( array $columns ) : array Make columns sortable - https://gist.github.com/906872.
product_sorting_link ( array $views ) : array Product sorting link.
quick_edit ( mixed $column_name, mixed $post_type ) Custom quick edit - form.
render_product_columns ( string $column ) Ouput custom columns for products.
render_shop_coupon_columns ( string $column ) Output custom columns for coupons.
render_shop_order_columns ( string $column ) Output custom columns for coupons.
request_query ( array $vars ) : array Filters and sorting handler.
restrict_manage_posts ( ) Filters for post types.
row_actions ( array $actions, WP_Post $post ) : array Set row actions for products and orders.
shop_coupon_columns ( array $existing_columns ) : array Define custom columns for coupons.
shop_coupon_filters ( ) Show custom filters to filter coupons by type.
shop_coupon_sortable_columns ( array $columns ) : array Make columns sortable - https://gist.github.com/906872.
shop_order_bulk_actions ( array $actions ) : array Manipulate shop order bulk actions.
shop_order_columns ( array $existing_columns ) : array Define custom columns for orders.
shop_order_filters ( ) Show custom filters to filter orders by status/customer.
shop_order_search_custom_fields ( WP_Query $wp ) Search custom fields as well as content.
shop_order_search_label ( mixed $query ) : string Change the label when searching orders.
shop_order_sortable_columns ( array $columns ) : array Make columns sortable - https://gist.github.com/906872.
show_cpt_archive_notice ( $post ) Show a notice above the CPT archive.
upload_dir ( array $pathdata ) : array Filter the directory for uploads.
woocommerce_media_upload_downloadable_product ( ) Run a filter when uploading a downloadable product.

Private Methods

Method Description
quick_edit_save ( integer $post_id, WC_Product $product ) Quick edit.

Method Details

__construct() public method

Constructor.
public __construct ( )

add_custom_query_var() public method

Query vars for custom searches.
public add_custom_query_var ( mixed $public_query_vars ) : array
$public_query_vars mixed
return array

bulk_action() public method

Process the new bulk actions for changing order status.
public bulk_action ( )

bulk_admin_notices() public method

Show confirmation message that order status changed for number of orders.
public bulk_admin_notices ( )

bulk_and_quick_edit_hook() public method

Offers a way to hook into save post without causing an infinite loop when quick/bulk saving product info.
Since: 2.7.0
public bulk_and_quick_edit_hook ( integer $post_id, object $post )
$post_id integer
$post object

bulk_and_quick_edit_save_post() public method

Quick and bulk edit saving.
public bulk_and_quick_edit_save_post ( integer $post_id, WP_Post $post ) : integer
$post_id integer
$post WP_Post
return integer

bulk_edit() public method

Custom bulk edit - form.
public bulk_edit ( mixed $column_name, mixed $post_type )
$column_name mixed
$post_type mixed

bulk_edit_save() public method

Bulk edit.
public bulk_edit_save ( integer $post_id, WC_Product $product )
$post_id integer
$product WC_Product

bulk_post_updated_messages() public method

Specify custom bulk actions messages for different post types.
public bulk_post_updated_messages ( array $bulk_messages, array $bulk_counts ) : array
$bulk_messages array
$bulk_counts array
return array

disable_autosave() public method

Disable the auto-save functionality for Orders.
public disable_autosave ( )

disable_dfw_feature_pointer() public method

Disable DFW feature pointer.

disable_view_mode_options() public method

View mode is seen on posts where you can switch between list or excerpt. Our post types don't support it, so we want to hide the useless UI from the screen options tab.
Since: 2.6
public disable_view_mode_options ( array $post_types ) : array
$post_types array Array of post types supporting view mode
return array Array of post types supporting view mode, without products, orders, and coupons

edit_form_after_title() public method

Print coupon description textarea field.
public edit_form_after_title ( WP_Post $post )
$post WP_Post

enter_title_here() public method

Change title boxes in admin.
public enter_title_here ( string $text, object $post ) : string
$text string
$post object
return string

handle_shop_order_bulk_actions() public method

Handle shop order bulk actions.
Since: 2.7.0
public handle_shop_order_bulk_actions ( string $redirect_to, string $action, array $ids ) : string
$redirect_to string URL to redirect to.
$action string Action name.
$ids array List of ids.
return string

hidden_meta_boxes() public method

Hidden default Meta-Boxes.
public hidden_meta_boxes ( array $hidden, object $screen ) : array
$hidden array
$screen object
return array

hide_cpt_archive_templates() public method

When editing the shop page, we should hide templates.
public hide_cpt_archive_templates ( $page_templates, $class, $post ) : array
return array

list_table_primary_column() public method

Support for WordPress 4.3.
public list_table_primary_column ( string $default, string $screen_id ) : string
$default string
$screen_id string
return string

maybe_render_blank_state() public method

Show blank slate.
public maybe_render_blank_state ( $which )

post_updated_messages() public method

Change messages when a post type is updated.
public post_updated_messages ( array $messages ) : array
$messages array
return array

process_product_file_download_paths() public method

orders for this product that have previously been granted downloadable file access.
Deprecation: and moved to post-data class.
public process_product_file_download_paths ( integer $product_id, integer $variation_id, array $downloadable_files )
$product_id integer product identifier
$variation_id integer optional product variation identifier
$downloadable_files array newly set files

product_columns() public method

Define custom columns for products.
public product_columns ( array $existing_columns ) : array
$existing_columns array
return array

product_data_visibility() public method

Output product visibility options.

product_filters() public method

Show a category filter box.
public product_filters ( )

product_filters_query() public method

Filter the products in admin based on options.
public product_filters_query ( mixed $query )
$query mixed

product_sortable_columns() public method

Make columns sortable - https://gist.github.com/906872.
public product_sortable_columns ( array $columns ) : array
$columns array
return array

quick_edit() public method

Custom quick edit - form.
public quick_edit ( mixed $column_name, mixed $post_type )
$column_name mixed
$post_type mixed

render_product_columns() public method

Ouput custom columns for products.
public render_product_columns ( string $column )
$column string

render_shop_coupon_columns() public method

Output custom columns for coupons.
public render_shop_coupon_columns ( string $column )
$column string

render_shop_order_columns() public method

Output custom columns for coupons.
public render_shop_order_columns ( string $column )
$column string

request_query() public method

Filters and sorting handler.
public request_query ( array $vars ) : array
$vars array
return array

restrict_manage_posts() public method

Filters for post types.

row_actions() public method

Set row actions for products and orders.
public row_actions ( array $actions, WP_Post $post ) : array
$actions array
$post WP_Post
return array

shop_coupon_columns() public method

Define custom columns for coupons.
public shop_coupon_columns ( array $existing_columns ) : array
$existing_columns array
return array

shop_coupon_filters() public method

Show custom filters to filter coupons by type.
public shop_coupon_filters ( )

shop_coupon_sortable_columns() public method

Make columns sortable - https://gist.github.com/906872.
public shop_coupon_sortable_columns ( array $columns ) : array
$columns array
return array

shop_order_bulk_actions() public method

Manipulate shop order bulk actions.
public shop_order_bulk_actions ( array $actions ) : array
$actions array List of actions.
return array

shop_order_columns() public method

Define custom columns for orders.
public shop_order_columns ( array $existing_columns ) : array
$existing_columns array
return array

shop_order_filters() public method

Show custom filters to filter orders by status/customer.
public shop_order_filters ( )

shop_order_search_custom_fields() public method

Search custom fields as well as content.
public shop_order_search_custom_fields ( WP_Query $wp )
$wp WP_Query

shop_order_search_label() public method

Change the label when searching orders.
public shop_order_search_label ( mixed $query ) : string
$query mixed
return string

shop_order_sortable_columns() public method

Make columns sortable - https://gist.github.com/906872.
public shop_order_sortable_columns ( array $columns ) : array
$columns array
return array

show_cpt_archive_notice() public method

Show a notice above the CPT archive.
public show_cpt_archive_notice ( $post )

upload_dir() public method

Filter the directory for uploads.
public upload_dir ( array $pathdata ) : array
$pathdata array
return array

woocommerce_media_upload_downloadable_product() public method

Run a filter when uploading a downloadable product.