Start with a clear plugin prompt
Adapt this example to your site, then paste it into your workspace. Include your WordPress, PHP, and relevant plugin versions so the request describes the environment you need to support.
Create a WordPress plugin that registers a [team_members] shortcode. It should display team profiles from a custom post type, accept department, limit, columns, and orderby attributes, and output accessible cards with each person’s photo, name, role, and biography excerpt. Add a settings page for default columns and a toggle for profile links. Sanitize shortcode attributes, escape output, use a WP_Query with pagination disabled, and include styles only when the shortcode appears.
Design a simple shortcode interface
A shortcode is easier for editors to use when its attributes are small, named clearly, and have sensible defaults. Start with the output you want readers to see, then decide which parts editors should control on each page. A listing shortcode might accept a category, limit, layout, and sort order; a callout shortcode might accept a title, button label, and destination. Include examples in your prompt so the plugin can make the accepted attributes and fallback behavior explicit for future editors.
Use WordPress content and query APIs carefully
Shortcodes commonly combine WordPress APIs such as add_shortcode, WP_Query, taxonomy queries, media functions, and options stored with the Settings API. Describe where the shortcode gets its data and whether it should read posts, custom post types, user profiles, or settings. The generated code can then validate attributes, prepare a constrained query, and escape the final markup. If it loads scripts or styles, define when they are needed so ordinary pages do not receive assets intended only for the shortcode output.
Verify output in the editor and front end
Test the shortcode in the block editor, classic editor if relevant, widgets, and the page builder used by your site. Try empty attributes, unexpected values, zero results, long titles, and narrow viewports. Confirm the rendered HTML fits the theme and can be understood with a keyboard and screen reader. For data-driven output, add enough sample records to check limits, sorting, and filters. Reviewing both the shortcode example and its rendered page helps editors use the feature consistently after the plugin is installed.
Frequently asked questions
What is a good shortcode prompt?
Describe the visible output, a sample shortcode, each attribute and default, the data source, and what should happen when no content matches.
Can a shortcode plugin have settings?
Yes. Use settings for site-wide defaults and shortcode attributes for page-specific choices that editors may need to change.