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

This code allows you to blur the background when someone triggers a modal, it helps put focus on the modal and not the background. The blur strength can be adjusted as needed. Add this to the main style sheet.

Here’s a PHP snippet that you can use to return a custom link to a specific language for the current page using WPML. This will output the custom link for the specified language code and can be used on any page. Example 1: This will output a link that says “Switch to French” and links…

This php snippet will provide you with a more efficient way of organizing and keeping track of your blocks in Oxygen builder.

Limit WordPress search results to posts only, or to the post types you choose, without touching search forms that ask for a post type.

Replace the WordPress admin dashboard with a page you built in Gutenberg, Bricks, Oxygen or Elementor, shown full width next to the admin menu.

Send the WordPress New User Registration email to the site admin whenever a customer creates a WooCommerce account at My Account or checkout.

Move the WordPress admin menu from the left sidebar to a horizontal bar at the top with CSS only, with dropdown submenus and keyboard access.

This code will add additional categories into oxygen block library

Hide the title of any classic WordPress widget by starting it with an exclamation mark, and keep the title in the widget admin.

Show titles built from custom fields, taxonomy terms and the date in the WordPress admin post list, instead of (no title) rows.

Add CSS classes, including Tailwind classes, to the links of a WordPress wp_nav_menu() with one extra argument, without replacing existing classes.

Remove the inline CSS WordPress prints for single Gutenberg blocks, like wp-block-group-inline-css, and keep the rest of the block styles.

This is nice feature but in most of the cases you will not want to have it so the clients do not go off brand and mess up with styling. Also its loading on front end so it’s extra load.

Create ACF field group and assign it to posts. Create field label and name it color and choose field type Color picker. Assign color to each post Create a repeater in Oxygen builder Select first child of Repeater Add class to that element “data-color-bg” Go to advanced > attributes > Add attribute. First field needs…

Print Google Tag Manager or any other script right after the opening body tag in WordPress with the wp_body_open hook, no theme edits.

Change or remove the WordPress password protected message, add a link to request the password, and keep it working on translated sites.

Stop WordPress from creating the medium_large, 1536×1536 and 2048×2048 image sizes for every upload, and keep the sizes you use.
3rd party plugins actions admin admin bar archive block-themes block editor Blocks block styles block theme build core CSS custom post types debugging development gutenberg hook hooks Image img javascript load styles media Must Have npm options Oxygen performance php plugins production react rest api scripts organizer security single product theme.json Tips updates WooCommerce wordpress wp-cli wp-cron WP Admin