WordPress — The World's Most Popular CMS
You are an expert in WordPress, the open-source CMS powering 43% of the web. You help developers build websites, blogs, e-commerce stores, and web applications using WordPress block editor (Gutenberg), custom themes, plugins, REST API, WP-CLI, and headless WordPress — from simple blogs to complex multi-site enterprise platforms.
Core Capabilities
WP-CLI (Command Line)
# Install WordPress
wp core download
wp config create --dbname=mysite --dbuser=root --dbpass=secret
wp core install --url=mysite.local --title="My Site" --admin_user=admin --admin_email=admin@example.com
# Manage plugins
wp plugin install woocommerce --activate
wp plugin install advanced-custom-fields --activate
wp plugin list --status=active
wp plugin update --all
# Manage content
wp post create --post_title="Hello World" --post_status=publish --post_type=post
wp post list --post_type=page --format=json
wp post meta update 42 custom_field "value"
# Database
wp db export backup.sql
wp search-replace "http://old.com" "https://new.com" --dry-run
wp db optimize
# Users
wp user create editor editor@example.com --role=editor
wp user list --role=administrator
REST API (Headless WordPress)
// Next.js frontend with WordPress as headless CMS
const WP_API = process.env.WORDPRESS_API_URL; // https://cms.example.com/wp-json/wp/v2
async function getPosts(page = 1, perPage = 10) {
const res = await fetch(
`${WP_API}/posts?page=${page}&per_page=${perPage}&_embed`,
{ next: { revalidate: 60 } },
);
const posts = await res.json();
const total = parseInt(res.headers.get("X-WP-Total") || "0");
return { posts, total };
}
async function getPostBySlug(slug: string) {
const res = await fetch(`${WP_API}/posts?slug=${slug}&_embed`);
const posts = await res.json();
return posts[0] || null;
}
// Custom post types via REST API
async function getProducts() {
const res = await fetch(`${WP_API}/products?_embed&per_page=50`);
return res.json();
}
// ACF (Advanced Custom Fields) data
// Requires ACF to REST API plugin
async function getPageWithACF(slug: string) {
const res = await fetch(`${WP_API}/pages?slug=${slug}&_fields=id,title,acf`);
const pages = await res.json();
return pages[0]?.acf; // Custom fields as JSON
}
Custom Theme (Block Theme)
// theme.json — Block theme configuration
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"color": {
"palette": [
{ "slug": "primary", "color": "#6366f1", "name": "Primary" },
{ "slug": "secondary", "color": "#0f172a", "name": "Secondary" }
]
},
"typography": {
"fontFamilies": [
{
"fontFamily": "Inter, sans-serif",
"slug": "inter",
"name": "Inter",
"fontFace": [
{ "fontFamily": "Inter", "fontWeight": "400 700", "src": ["file:./assets/fonts/Inter.woff2"] }
]
}
],
"fontSizes": [
{ "slug": "small", "size": "0.875rem", "name": "Small" },
{ "slug": "medium", "size": "1rem", "name": "Medium" },
{ "slug": "large", "size": "1.5rem", "name": "Large" },
{ "slug": "x-large", "size": "2.5rem", "name": "Extra Large" }
]
},
"layout": { "contentSize": "720px", "wideSize": "1200px" }
}
}
WooCommerce Integration
// Custom WooCommerce endpoint
add_action('rest_api_init', function() {
register_rest_route('custom/v1', '/featured-products', [
'methods' => 'GET',
'callback' => function() {
$products = wc_get_products([
'featured' => true,
'limit' => 12,
'status' => 'publish',
]);
return array_map(function($product) {
return [
'id' => $product->get_id(),
'name' => $product->get_name(),
'price' => $product->get_price(),
'image' => wp_get_attachment_url($product->get_image_id()),
'permalink' => $product->get_permalink(),
];
}, $products);
},
'permission_callback' => '__return_true',
]);
});
Installation
# Docker
docker run -d --name wordpress -p 8080:80 \
-e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_PASSWORD=secret \
-v wp_data:/var/www/html wordpress:latest
# Or via WP-CLI
wp core download && wp config create && wp core install
Best Practices
- Block themes — Use theme.json + HTML block templates; modern WordPress development, no PHP templates needed
- Headless for custom frontends — Use WordPress REST API + Next.js/Nuxt for full control over frontend performance
- ACF for custom fields — Advanced Custom Fields for structured content (hero sections, team bios, product specs)
- WP-CLI for automation — Script installations, updates, content imports, and database operations
- Security — Keep core/plugins updated, use strong passwords, install Wordfence, disable xmlrpc.php, limit login attempts
- Performance — Use caching plugin (WP Super Cache, W3 Total), CDN (Cloudflare), image optimization (ShortPixel)
- Custom post types — Register CPTs for structured content beyond posts/pages (products, events, testimonials)
- Multisite — Use WordPress Multisite for managing multiple sites from one installation (agencies, networks)
1---2name: wordpress3description: >-4 You are an expert in WordPress, the open-source CMS powering 43% of the5 web. You help developers build websites, blogs, e-commerce stores, and web6 applications using WordPress block editor (Gutenberg), custom themes,7 plugins, REST API, WP-CLI, and headless WordPress — from simple blogs to8 complex multi-site enterprise platforms.9license: Apache-2.010compatibility: ''11metadata:12 source: https://skillmd.com/skills/eliferjunior/wordpress13 author: terminal-skills14 version: 1.0.015 category: Web Development16 tags:17 - cms18 - php19 - blog20 - ecommerce21 - plugins22 - themes23 - self-hosted24---2526# WordPress — The World's Most Popular CMS2728You are an expert in WordPress, the open-source CMS powering 43% of the web. You help developers build websites, blogs, e-commerce stores, and web applications using WordPress block editor (Gutenberg), custom themes, plugins, REST API, WP-CLI, and headless WordPress — from simple blogs to complex multi-site enterprise platforms.2930## Core Capabilities3132### WP-CLI (Command Line)3334```bash35# Install WordPress36wp core download37wp config create --dbname=mysite --dbuser=root --dbpass=secret38wp core install --url=mysite.local --title="My Site" --admin_user=admin --admin_email=admin@example.com3940# Manage plugins41wp plugin install woocommerce --activate42wp plugin install advanced-custom-fields --activate43wp plugin list --status=active44wp plugin update --all4546# Manage content47wp post create --post_title="Hello World" --post_status=publish --post_type=post48wp post list --post_type=page --format=json49wp post meta update 42 custom_field "value"5051# Database52wp db export backup.sql53wp search-replace "http://old.com" "https://new.com" --dry-run54wp db optimize5556# Users57wp user create editor editor@example.com --role=editor58wp user list --role=administrator59```6061### REST API (Headless WordPress)6263```typescript64// Next.js frontend with WordPress as headless CMS65const WP_API = process.env.WORDPRESS_API_URL; // https://cms.example.com/wp-json/wp/v26667async function getPosts(page = 1, perPage = 10) {68 const res = await fetch(69 `${WP_API}/posts?page=${page}&per_page=${perPage}&_embed`,70 { next: { revalidate: 60 } },71 );72 const posts = await res.json();73 const total = parseInt(res.headers.get("X-WP-Total") || "0");74 return { posts, total };75}7677async function getPostBySlug(slug: string) {78 const res = await fetch(`${WP_API}/posts?slug=${slug}&_embed`);79 const posts = await res.json();80 return posts[0] || null;81}8283// Custom post types via REST API84async function getProducts() {85 const res = await fetch(`${WP_API}/products?_embed&per_page=50`);86 return res.json();87}8889// ACF (Advanced Custom Fields) data90// Requires ACF to REST API plugin91async function getPageWithACF(slug: string) {92 const res = await fetch(`${WP_API}/pages?slug=${slug}&_fields=id,title,acf`);93 const pages = await res.json();94 return pages[0]?.acf; // Custom fields as JSON95}96```9798### Custom Theme (Block Theme)99100```json101// theme.json — Block theme configuration102{103 "$schema": "https://schemas.wp.org/trunk/theme.json",104 "version": 2,105 "settings": {106 "color": {107 "palette": [108 { "slug": "primary", "color": "#6366f1", "name": "Primary" },109 { "slug": "secondary", "color": "#0f172a", "name": "Secondary" }110 ]111 },112 "typography": {113 "fontFamilies": [114 {115 "fontFamily": "Inter, sans-serif",116 "slug": "inter",117 "name": "Inter",118 "fontFace": [119 { "fontFamily": "Inter", "fontWeight": "400 700", "src": ["file:./assets/fonts/Inter.woff2"] }120 ]121 }122 ],123 "fontSizes": [124 { "slug": "small", "size": "0.875rem", "name": "Small" },125 { "slug": "medium", "size": "1rem", "name": "Medium" },126 { "slug": "large", "size": "1.5rem", "name": "Large" },127 { "slug": "x-large", "size": "2.5rem", "name": "Extra Large" }128 ]129 },130 "layout": { "contentSize": "720px", "wideSize": "1200px" }131 }132}133```134135### WooCommerce Integration136137```php138// Custom WooCommerce endpoint139add_action('rest_api_init', function() {140 register_rest_route('custom/v1', '/featured-products', [141 'methods' => 'GET',142 'callback' => function() {143 $products = wc_get_products([144 'featured' => true,145 'limit' => 12,146 'status' => 'publish',147 ]);148 return array_map(function($product) {149 return [150 'id' => $product->get_id(),151 'name' => $product->get_name(),152 'price' => $product->get_price(),153 'image' => wp_get_attachment_url($product->get_image_id()),154 'permalink' => $product->get_permalink(),155 ];156 }, $products);157 },158 'permission_callback' => '__return_true',159 ]);160});161```162163## Installation164165```bash166# Docker167docker run -d --name wordpress -p 8080:80 \168 -e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_PASSWORD=secret \169 -v wp_data:/var/www/html wordpress:latest170171# Or via WP-CLI172wp core download && wp config create && wp core install173```174175## Best Practices1761771. **Block themes** — Use theme.json + HTML block templates; modern WordPress development, no PHP templates needed1782. **Headless for custom frontends** — Use WordPress REST API + Next.js/Nuxt for full control over frontend performance1793. **ACF for custom fields** — Advanced Custom Fields for structured content (hero sections, team bios, product specs)1804. **WP-CLI for automation** — Script installations, updates, content imports, and database operations1815. **Security** — Keep core/plugins updated, use strong passwords, install Wordfence, disable xmlrpc.php, limit login attempts1826. **Performance** — Use caching plugin (WP Super Cache, W3 Total), CDN (Cloudflare), image optimization (ShortPixel)1837. **Custom post types** — Register CPTs for structured content beyond posts/pages (products, events, testimonials)1848. **Multisite** — Use WordPress Multisite for managing multiple sites from one installation (agencies, networks)