class WordPressCustomPostTypeServiceProvider extends ServiceProvider

Properties

protected $plugin Instance of main plugin. from ServiceProvider
protected string $id Post type key, must not exceed 20 characters.
protected string $name Name of the post type shown in the menu.
protected string $plural Name of the post type shown in the menu as plural.
protected array $labels An array of labels for this post type.
protected string $description A short descriptive summary of what the post type is. Defaults to blank.
protected bool $public Whether a post type is intended for use publicly either via the admin interface or by front-end users.
protected bool $hierarchical Whether the post type is hierarchical (e.g. page). Defaults to false.
protected bool $excludeFromSearch Whether to exclude posts with this post type from front end search results.
protected bool $publiclyQueryable Whether queries can be performed on the front end for the post type as part of parse_request().
protected bool $showUI Whether to generate a default UI for managing this post type in the admin.
protected bool $showInMenu Where to show the post type in the admin menu.
protected bool $showInNavMenus Makes this post type available for selection in navigation menus.
protected bool $showInAdminBar Makes this post type available via the admin bar.
protected null $menuPosition The position in the menu order the post type should appear.
protected string $menuIcon The url to the icon to be used for this menu. Defaults to use the posts icon.
protected string $capabilityType The string to use to build the read, edit, and delete capabilities. Defaults to 'post'.
protected array $capabilities Array of capabilities for this post type.
protected bool $mapMetaCap Whether to use the internal default meta capability handling. Defaults to false.
protected array $supports An alias for calling add_post_type_support() directly. Defaults to title and editor.
protected null $registerMetaBoxCallback Provide a callback function that sets up the meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback.
protected array $taxonomies An array of taxonomy identifiers that will be registered for the post type.
protected bool $hasArchive True to enable post type archives. Default is false.
protected array $rewrite Triggers the handling of rewrites for this post type. Defaults to true, using $post_type as slug.
protected string $slug Customize the permastruct slug. Defaults to $post_type key
protected bool $withFront Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.
protected bool $feeds Should a feed permastruct be built for this post type. Inherits default from has_archive.
protected bool $pages Should the permastruct provide for pagination. Defaults to true.
protected int $epMask Assign an endpoint mask.
protected string $queryVar Sets the query_var key for this post type. Defaults to $post_type key If false, a post type cannot be loaded at ?{query_var}={post_slug} If specified as a string, the query ?{query_var_string}={post_slug} will be valid.
protected bool $canExport Allows this post type to be exported. Defaults to true.
protected bool $deleteWithUser Whether to delete posts of this type when deleting a user.

Methods

void
register()

Register the service provider.

__construct($plugin)

No description

__call(string $method, array $parameters)

Dynamically handle missing method calls.

boot()

You may override this method in order to register your own actions and filters.

initHooks()

No description

args()

No description

array
rewrite()

To specify rewrite rules, an array can be passed with any of these keys

array
supports()

See {@link add_post_type_support()} for documentation.

array
labels()

You can see accepted values in {@link get_post_type_labels()}.

bool
is()

Return TRUE if this custom post type is current view.

void
save_post(int|string $post_id, object $post = null)

This action is called when a post is save or updated. Use the save_post_{post_type} hook

update(int|string $post_id, object $post)

Override this method to save/update your custom data.

Details

at line 298
void register()

Register the service provider.

Return Value

void

in ServiceProvider at line 22
__construct($plugin)

Parameters

$plugin

in ServiceProvider at line 33
__call(string $method, array $parameters)

Dynamically handle missing method calls.

Parameters

string $method
array $parameters

at line 312
boot()

You may override this method in order to register your own actions and filters.

at line 317
protected initHooks()

at line 327
protected args()

at line 373
protected array rewrite()

To specify rewrite rules, an array can be passed with any of these keys

'slug' => string Customize the permastruct slug. Defaults to $post_type key 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true. 'feeds' => bool Should a feed permastruct be built for this post type. Inherits default from has_archive. 'pages' => bool Should the permastruct provide for pagination. Defaults to true. 'ep_mask' => const Assign an endpoint mask.

If not specified and permalink_epmask is set, inherits from permalink_epmask. If not specified and permalink_epmask is not set, defaults to EP_PERMALINK

Return Value

array

at line 392
protected array supports()

See {@link add_post_type_support()} for documentation.

Return Value

array

at line 417
protected array labels()

You can see accepted values in {@link get_post_type_labels()}.

Return Value

array

at line 451
bool is()

Return TRUE if this custom post type is current view.

Return Value

bool

at line 469
void save_post(int|string $post_id, object $post = null)

This action is called when a post is save or updated. Use the save_post_{post_type} hook

Parameters

int|string $post_id Post ID
object $post Optional. Post object

Return Value

void

at line 518
update(int|string $post_id, object $post)

Override this method to save/update your custom data.

This method is called by hook action save_post_{post_type}`

Parameters

int|string $post_id Post ID
object $post Optional. Post object