WordPress
WordPress (WordPress.org) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database. WordPress was originally created as a blog-publishing system but has evolved to support other types of web content including more traditional mailing lists and forums, media galleries, membership sites, learning management systems (LMS) and online stores.
Examples
n. One that is representative of a group as a whole. n. One serving as a pattern of a specific k...
Minimal Cron
Change the following: Prefix: svd_ function svd_deactivate() { wp_clear_scheduled_hook( '...
Run WP CLI On All Sites Within A Network
# update an option. wp site list --field=url | xargs -I % wp --url=% option update [option na...
Hooks for assets
Quick reference for where to hook in styles and scripts: Where Action Admin adm...
Updating post data on status transition
You might be tempted to set the WP_Post properties (but this is an action), or use wp_update_post...
Filter one-liners
Render links in content as HTML A elements: add_filter( 'the_content', 'make_clickable' );
WP-CLI create post with custom tax
wp mycpt create --tags='test1,test2' $tags = null; if ( isset( $assoc_args['tags'] ) ) { $tag...
Hiding blocks from the block inserter
Hiding blocks allow the blocks to be used for existing content, but not for new content. function...
Troubleshooting
Sync the database schema
In rare situations, the WordPress database schema might not match the schema expected by the appl...
Troubleshooting local environment problems
A collection of troubleshooting tips to diagnose issues with a local environment that's not worki...
Resolving composer.lock merge conflicts
composer update --lock fixes lock file when merging branches with .lock conflicts.
Package type "library" is not supported
You might see the following message after running composer: Reading /Users/svandragt/.composer/a...
WordPress Importer Plugin
It has support for: deduplication (see below), mapping image urls All imported posts haven impo...
Knowledge
Knowledge is a familiarity, awareness, or understanding of someone or something, such as facts, i...
Nonces
WordPress nonces are not cryptographic nonces, as the latter are used only once, and the former...
Move a site to a new domain
Move a site workflow: Delete existing domain mappings for the site. wp search replace $old_ur...
Change root site
To change the root site in a multisite network: define( 'BLOG_ID_CURRENT_SITE', 1 ); Plugins mi...
Blocks in Simple English
The following block types exist and this is what they do. I'm always getting confused by the term...
Filtering Block based content
Name Type Usage parse_blocks( string $content ) Function if you want to take a bun...
Auto linking project toolchains
If you use direnv you can automatically setup your project toolchain requirements. In the case of...
Performance Strategy
CDN for assets Full page cache such as Batcache Fragment caching for menus Longcache for lower t...
Performance
When migrating content, suspend cache invalidation and flush the cache afterwards. With that in m...
WP-CLI
To download all attachment files from a remote site: from your local uploads directory: wp post l...
Installing wp-env
wp-env is pretty nice and the .wp-env.json file makes me think it's most of the way there as a ge...