Functions

19 Sep 2022 0

ACPT exposes a complete set of php functions to manage custom post types and meta fields.

Use these tables for quick reference.

Settings

Custom post types
register_acpt_post_type
Close

Description

Register a new custom post type.

Usage

register_acpt_post_type([ 'post_name' => 'cpt', 'singular_label' => 'New CPT', 'plural_label' => 'New CPTs', 'icon' => 'admin-appearance', 'supports' => [ 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', ], 'labels' => [], 'settings' => [], ]);

Parameters

  • post_name (string) (Required) The post name
  • singular_label (string) (Required) The post singular label
  • plural_label (string) (Required) The plural label
  • icon (string) (Required) The admin icon (see dashicon list)
  • supports (array) (Required) Refer to official documentation
  • labels (array) (Required) Refer to official documentation
  • settings (array) (Required) Refer to official documentation

Return

  • boolean
Register a new custom post type.
delete_acpt_post_type
Close

Description

Delete a custom post type.

Usage

delete_acpt_post_type('new-cpt', true);

Parameters

  • post_name (string) (Required) The post name
  • delete_posts (boolean) Delete associated posts

Return

  • boolean
Delete a custom post type.
Option pages
register_acpt_option_pageRegister a new option page.
delete_acpt_option_pageDelete an option page.
Taxonomies
register_acpt_taxonomyRegister a new custom taxonomy.
delete_acpt_taxonomyDelete a custom taxonomy.
assoc_acpt_taxonomy_to_acpt_post
Close

Description

Associate a custom taxonomy to a custom post type.

Usage

assoc_acpt_taxonomy_to_acpt_post('new-tax', 'page');

Parameters

  • taxonomy (string) (Required) The taxonomy slug
  • post_type (string) (Required) The post type name

Return

  • boolean
Associate a custom taxonomy to a custom post type.
remove_assoc_acpt_taxonomy_from_acpt_post
Close

Description

Remove association between a taxonomy to a post type.

Usage

remove_assoc_acpt_taxonomy_from_acpt_post('new-tax', 'page');

Parameters

  • taxonomy (string) (Required) The taxonomy slug
  • post_type (string) (Required) The post type name

Return

  • boolean
Remove association between a taxonomy to a post type.

Fields

CPT meta fields
add_acpt_meta_boxAdd meta box settings to custom post type.
add_acpt_meta_fieldAdd meta field settings to custom post type.
delete_acpt_metaDelete all custom post type meta settings.
delete_acpt_meta_boxDelete ustom post type meta box settings.
delete_acpt_meta_fieldDelete custom post type meta field settings.
edit_acpt_meta_boxEdit custom post type meta box settings.
edit_acpt_meta_fieldEdit custom post type meta field settings.
get_acpt_meta_objectsReturns the settings of all custom post type fields saved on a specific post.
get_acpt_box_objectReturns the settings of a specific custom post type meta box.
get_acpt_field_objectReturns the settings of a specific custom post type field.
Taxonomy meta fields
add_acpt_tax_meta_boxAdd meta box settings to taxonomy.
add_acpt_tax_meta_fieldAdd meta field settings to taxonomy.
delete_acpt_tax_metaDelete all taxonomy meta settings.
delete_acpt_tax_meta_boxDelete taxonomy meta box settings.
delete_acpt_tax_meta_fieldDelete taxonomy meta field settings.
edit_acpt_tax_meta_boxEdit taxonomy meta box settings.
edit_acpt_tax_meta_fieldEdit taxonomy meta field settings.
get_acpt_tax_meta_objectsReturns the settings of all taxonomy fields saved on a specific term.
get_acpt_tax_box_objectReturns the settings of a specific custom taxonomy box.
get_acpt_tax_field_objectReturns the settings of a specific taxonomy field.
Option page fields
add_acpt_option_page_meta_boxAdd meta box settings to option page.
add_acpt_option_page_meta_fieldAdd meta field settings to option page.
delete_acpt_option_page_meta_boxDelete all option page meta box settings.
delete_acpt_option_page_meta_fieldDelete option page meta field settings.
edit_acpt_option_page_meta_boxEdit option page meta box settings.
edit_acpt_option_page_meta_fieldEdit option page meta field settings.
get_acpt_option_page_meta_objectsReturns the settings of all option page fields saved on a specific page.
get_acpt_option_page_box_objectReturns the settings of a specific option page box.
get_acpt_option_page_field_objectReturns the settings of a specific option page field.
User meta fields
add_acpt_user_meta_boxAdd meta box settings to user.
add_acpt_user_meta_fieldAdd meta field settings to user.
delete_acpt_user_metaDelete all user meta settings.
delete_acpt_user_meta_boxDelete user meta box settings.
delete_acpt_user_meta_fieldDelete user meta field settings.
edit_acpt_user_meta_boxEdit user meta box settings.
edit_acpt_user_meta_fieldEdit user meta field settings.
get_acpt_user_meta_objectsReturns the settings of all user fields saved on a specific user.
get_acpt_user_box_objectReturns the settings of a specific custom user box.
get_acpt_user_field_objectReturns the settings of a specific user field.

Values

Save CPT meta field values
add_acpt_meta_field_valueAdd custom post type meta field value.
add_acpt_meta_block_field_row_valueAdd meta field settings to a custom post type Flexible field.
delete_acpt_meta_field_valueDelete custom post type meta field value.
delete_acpt_meta_block_field_row_valueDelete meta field settings for a specific custom post type Flexible field.
edit_acpt_meta_block_field_row_valueEdit meta field settings for a specific custom post type Flexible field.
edit_acpt_meta_field_valueEdit custom post type meta field value.
add_acpt_meta_field_row_valueAdd custom post type meta field row value (only for Repeater and List).
delete_acpt_meta_field_row_valueDelete custom post type meta field row value (only for Repeater and List).
edit_acpt_meta_field_row_valueEdit custom post type meta field row value (only for Repeater and List).
Retrieve CPT meta field values
get_acpt_fieldsReturns an array of field values (name => value) for a specific post/box.
get_acpt_field_row_objectReturns the settings of a specific sub field (only for Repeater).
acpt_field_has_rowsUsed to loop through a parent field's value (only for Repeater and List).
get_acpt_fieldReturns the value of a specific field.
acpt_fieldDisplays the value of a specific field.
acpt_block_child_fieldDisplays a field value nested in a Flexible block.
acpt_field_has_blocksChecks if a field value contains any block.
get_acpt_block_child_fieldGet a field value nested in a Flexible block.
is_acpt_field_visibleGet a field value nested in a Flexible block.
Save Option page meta field values
add_acpt_option_page_meta_field_valueAdd option page meta field value.
add_acpt_option_page_meta_block_field_row_valueAdd meta field settings to a field.
delete_acpt_option_page_meta_field_valueDelete option page meta field value.
delete_acpt_option_page_meta_block_field_row_valueDelete meta field settings for a specific Flexible field.
edit_acpt_option_page_meta_block_field_row_valueEdit meta field settings for a specific Flexible field.
edit_acpt_option_page_meta_field_valueEdit option page meta field value.
add_acpt_option_page_meta_field_row_valueAdd option page meta field row value (only for Repeater and List).
delete_acpt_option_page_meta_field_row_valueDelete option page meta field row value (only for Repeater and List).
edit_acpt_option_page_meta_field_row_valueEdit option page meta field row value (only for Repeater and List).
Retrieve Option page meta field values
get_acpt_option_page_fieldsReturns an array of option page field values (name => value) for a specific post/box.
get_acpt_option_page_field_row_objectReturns the settings of a specific option page sub field (only for Repeater).
acpt_field_option_page_has_rowsUsed to loop through a parent option page field's value (only for Repeater and List).
get_option_page_fieldReturns the value of a specific option page field.
acpt_option_page_fieldDisplays the value of a specific option page field.
acpt_option_page_block_child_fieldDisplays a field value nested in a Flexible block.
acpt_option_page_field_has_blocksChecks if a field value contains any block.
get_acpt_option_page_block_child_fieldGet a field value nested in a Flexible block.
is_acpt_option_page_field_visibleGet a field value nested in a Flexible block.
Save taxonomy meta field values
add_acpt_tax_meta_field_valueAdd taxonomy meta field value.
delete_acpt_tax_meta_field_valueDelete taxonomy meta field value.
edit_acpt_tax_meta_field_valueEdit taxonomy meta field value.
add_acpt_tax_meta_field_row_valueAdd taxonomy meta field row value (only for Repeater and List).
delete_acpt_tax_meta_field_row_valueDelete taxonomy meta field row value (only for List).
edit_acpt_tax_meta_field_row_valueEdit taxonomy meta field row value (only for List).
Retrieve taxonomy meta field values
get_acpt_tax_fieldsReturns an array of field values (name => value) for a specific term/box.
acpt_tax_field_has_rowsUsed to loop through a parent field's value (only for List).
get_acpt_tax_fieldReturns the value of a specific field.
acpt_tax_fieldDisplays the value of a specific field.
is_acpt_tax_field_visibleChecks if a taxonomy field value is visible or not.
Save user meta field values
add_acpt_user_meta_field_valueAdd user meta field value.
delete_acpt_user_meta_field_valueDelete user meta field value.
edit_acpt_user_meta_field_valueEdit user meta field value.
add_acpt_user_meta_field_row_valueAdd user meta field row value (only for List).
delete_acpt_user_meta_field_row_valueDelete user meta field row value (only for Repeater and List).
edit_acpt_user_meta_field_row_valueEdit user meta field row value (only for Repeater and List).
Retrieve user meta field values
get_acpt_user_fieldsReturns an array of field values (name => value) for a specific term/box.
acpt_user_field_has_rowsUsed to loop through a parent field's value (only for List).
get_acpt_user_fieldReturns the value of a specific field.
acpt_user_fieldDisplays the value of a specific field.

20% Discount!


Use this code during check-out:

ACPT_2024_PROMO_20

Valid for all products*

*This coupon code is valid for all products and plans. The promotion expires April, 30th 2025 00:00:00 UTC

This will close in 20 seconds