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

Sometimes when you are in a development environment like Laravel Valet on your home computer, you may have errors show up. you can use the following code to hide them Edit wp-config.php file and add the following anywhere ini_set(‘display_errors’,’Off’); ini_set(‘error_reporting’, E_ALL ); define(‘WP_DEBUG’, false); define(‘WP_DEBUG_DISPLAY’, false);

Use the following code to add extra required classes during Oxywind worker compiling / cache generation when you are ready for production. You may want to do this if you want to use tailwind classes in your HTML code outside of oxygen elsewhere in wordpress or a 3rd party / custom plugin. This will save…

Setup daisyUI CDN Ready For Development Add the following code to use the full daisyUI CDN while developing, this includes all daisyUI elements. These will be later purged by the Oxywind worker so only the elements you use will be included in your production site. Add daisyUI To Oxywind Worker Configuration In the Oxywind settings…

This is taken form Facebook conversation in the Official Oxygen Builder group. Follow up on the conversation.

A WordPress shortcode that shows the terms of any taxonomy as links, limited to a number you choose, with escaped output and no PHP warnings.

This allows you to hide that ruler on the bottom of the builder that often gets in the way of doing mobile responsive work. Set as CSS custom code

Put an Add Media upload link on the WordPress admin bar, in wp-admin and on the front end, for users who can upload files.

This is a snippet for Oxy Ultimate Woo plugin that allows you to change the default “No product in cart” to anything you like. Credit to the Developer, you can see the original code here

Fo those using Oxy Ultimate Woo Cart component, this is a snippet to change the text on the checkout button to anything you need. This is courtesy of the developer and work perfectly, see original here

Remove the Gutenberg block library CSS and global styles from the WordPress front end on classic sites, with a config for what to keep.

Quite simply add this near the apply_filters or do_action.

Make WordPress save every uploaded file with a lowercase file name, or only images, so URLs stay consistent on case-sensitive servers.

Oxygen page builder Image element does provide the feature to insert an Image-type custom field’s Alt text using the dynamic data. but if you need overwrite then see 2nd option. Step for show alt tag for image. Ensure that your Image field’s Return Format is set to Image Array in your ACF field group. Step 2 Option 1 Option…

Make the WordPress search match the post title only, not the content, on the front-end search page; wp-admin and other queries keep the normal search.

Sometimes you have a situation where you want the customer to log in, like a donation page, but you don’t want them to end up at /my-account/ but rather be taken back to the page where they were when they started. This code is useful for donation sites, as well as refer a friend scenarios.

Add a Copy button to every code block on your WordPress site with plain CSS and JavaScript: Clipboard API, http fallback, keyboard accessible.

Send WordPress users to the home page after they log out, instead of the login screen, with the logout_redirect filter.

Set the theme-color meta tag in WordPress so mobile browsers paint their address bar and top of the screen in your brand colour.
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