Files
nexus/wiki/entities/WordPress.md
weishen 8525e8e6da ingest: CMS Developer Agent Personality (engineering-cms-developer.md)
- Source: sources/engineering-cms-developer.md
- Entities: WordPress, Drupal
- Concepts: ContentModel-first, CodeOverConfiguration
- Updated: index.md (Sources/Entities/Concepts), overview.md, log.md
2026-05-01 15:21:22 +08:00

74 lines
2.6 KiB
Markdown

---
title: "WordPress"
type: entity
tags: [cms, php, open-source]
last_updated: 2026-05-01
---
## Overview
WordPress is an open-source CMS (Content Management System) written in PHP, powering 40%+ of all websites globally. Primary use cases: blogs, brochure sites, WooCommerce e-commerce stores, headless CMS with REST/GraphQL API.
## Aliases
- WP
- WordPress.org (self-hosted vs wordpress.com)
## Key Characteristics
- **Editing simplicity**: Gutenberg block editor (5.0+), intuitive for non-technical editors
- **Plugin ecosystem**: 60,000+ plugins via wordpress.org repository
- **Theme system**: Child themes (never modify parent directly), code-first registration of post types/taxonomies/fields
- **Configuration**: Settings in `wp-config.php` or code — not the database
- **Custom post types & taxonomies**: Registered in code via `register_post_type()` / `register_taxonomy()`, not UI
- **ACF Pro**: Advanced Custom Fields plugin for structured content; field groups synced via ACF JSON
## WordPress Coding Patterns
### Register Custom Post Type (code, not UI)
```php
add_action( 'init', function () {
register_post_type( 'case_study', [
'labels' => [
'name' => 'Case Studies',
'singular_name' => 'Case Study',
],
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'menu_icon' => 'dashicons-portfolio',
'supports' => [ 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ],
'rewrite' => [ 'slug' => 'case-studies' ],
] );
} );
```
### Gutenberg Custom Block (block.json + PHP render)
**block.json** defines the block schema and registers editor + render scripts. **render.php** handles server-side rendering without JavaScript dependency.
### ACF Block Registration
```php
add_action( 'acf/init', function () {
acf_register_block_type( [
'name' => 'testimonial',
'title' => 'Testimonial',
'render_callback' => 'my_theme_render_testimonial',
'category' => 'my-theme',
'supports' => [ 'align' => false, 'jsx' => true ],
] );
} );
```
## Connections
- [[CMSDeveloper]] uses WordPress as a primary CMS platform
- [[ContentModel-first]] applies to WordPress content modeling before theme code
- [[CodeOverConfiguration]] — WordPress settings belong in wp-config.php or code
- [[WooCommerce]] extends WordPress for e-commerce use cases
- [[HeadlessWP]] — WordPress as headless backend with Next.js/Nuxt front-end
## Sources
- [[engineering-cms-developer]]