
WordPress code snippets for hooks, custom post types, the REST API, WP_Query, admin screens and more. Copy, paste and adapt.

A WordPress YouTube shortcode that shows a thumbnail and loads the privacy-friendly youtube-nocookie player only when the visitor clicks play.

Add an ID column to the WordPress admin lists of posts, pages and custom post types, so you never open a post just to find its ID.

Register custom image sizes in WordPress and show them in the editor image size dropdown, from one config with name, width, height and crop.

A WordPress admin dark theme in a few lines of CSS: dark wp-admin screens and block editor UI, real colours for images and the editor canvas.

At the moment we have option to select pages on which you want to apply scripts. Thats why I made a small code snippet to help you create this option as well. Write Page, Post ID or Slug on witch pages you don’t want that script is applied and it will be applied on all…

Slow down the WordPress Heartbeat API and switch it off on the front end or in wp-admin, without breaking post locks or a plugin.

Change the WordPress widget title tag from h2 to h4 (or any heading) for every sidebar, keeping the theme’s classes and the title text as they are.

Remove “Category:”, “Tag:”, “Archives:” and the other prefixes from WordPress archive titles with one filter, in classic and block themes.

Color chosen WordPress admin menu items with your own background and text colours, so the screens you use daily stand out in the sidebar.

Give a WordPress custom post type the normal Categories and Tags and show those posts on category and tag archives, with or without Custom Post Type UI.

Show any taxonomy as a column in WordPress admin post lists, including custom post types, with one config array and no placeholders.

Give WordPress posts or custom post types a Parent field like pages, with register_post_type_args, safe for post types registered without supports.

Place it above Repeater or East Posts

Change the order of the WordPress blog and archive loop, for example oldest posts first, with pre_get_posts and without touching templates.

This one is work in progress

Show WordPress previous and next post links with the title and featured image under a single post, with escaped output and no errors on the first post.

Stop WordPress compressing resized images at quality 82: set your own JPEG and WebP quality with the wp_editor_set_quality filter.

Limit WordPress search results to the post types you choose, such as posts and pages, without touching admin, REST or custom queries.
3rd party plugins actions admin archive block-themes block editor Blocks block theme build capabilities core CSS Custom Post custom post types Developer development filters Front End full site editing gutenberg hook Image img load styles maintenance media mu-plugin Must Have npm Oxygen performance php plugins scripts organizer security SEO settings api single product theme.json Tips updates WooCommerce wordpress wp-cli WP Admin