LLM Prompts

Generate Custom Post Type Code

Generates PHP code for registering a custom post type in WordPress.

The method

Use this prompt to generate code snippets for registering custom post types in WordPress. Provide the desired post type name, supported features, and any custom arguments. Paste the generated code into your theme’s `functions.php` file or a custom plugin for registration. Ideal for developers extending WordPress functionality.

The prompts

Prompt 1
I need to create a custom post type for 'Books' in WordPress. It should support 'title', 'editor', 'thumbnail', 'excerpt', and 'custom-fields'. Generate the PHP code to register this post type. I also want to assign a custom icon from dashicons called 'dashicons-book'. Please ensure the post type is publicly queryable and shows in the WordPress admin menu.
Prompt 2
Generate the PHP code to register a custom post type called 'Events' in WordPress. This post type should support 'title', 'editor', 'thumbnail', 'custom-fields', and 'revisions'. I also need custom taxonomy called 'Event Categories' associated with this post type. The slug for the event category should be 'event-category'. The Events post type should use the 'dashicons-calendar' icon. Make sure the event post type is hierarchical.