ACF apparently expands shortcodes before returning content, which means if you attempt to run it through the_content filter, any line breaks will get hit by wpautop. We fought and fought and fought, moving filter orders around, removing filters, etc., and finally decided to not fight WordPress, but instead change Gravity…
Category: Plugins
ACF Flexible Content image previews, 2.0
We’ve been using this gist for years now for creating image previews for ACF Flexible Content components. Very recently it just stopped working, however. Our best guess is that it is a race condition of some sort, most likely caused by the DOM being generated in JS later. The fix…
Programmatically setting ACF license key
EDIT – 2022-04-12 This code doesn’t actually work. I think it did while I was testing because of some glitches elsewhere. Instead, you can now just set the constant ACF_PRO_LICENSE. You can use the following code to inject the Advanced Custom Fields Pro license key automatically:
Remove buttons from a WYSIWYG editor for a specific ACF field type
You can pretty easily customize the advanced custom fields WYSIWYG toolbars globally, however doing so on a case-by-case basis needs to be done in JS since the editing experience is so dynamic. This code is looking for a specific ACF field called step_text and sets the WYSIWYG editor to only…
WordPress, rel canonical missing
We’ve got a site with WP SEO and WPML that we needed <link rel=”canonical” /> on but we couldn’t get it to output no matter what we tried. First, we actually usually disable that tag on most sites so we checked that it wasn’t us. Good there. Second, we poked…
Better Nginx rules for BWP Minify
The plugin Better WordPress Minify is a great plugin for handling CSS and JS merging and minification. I’ve been using it for years now but just noticed today that there’s a weird header being emitted on some of my sites. Pragma: no-cache; What!?! No, please cache! Turns out it (probably) wasn’t…
Preferred WP/ACF image usage
In ACF, try to never use the_sub_field() on an image and always have ACF return an image array, especially for larger images. Calling the_sub_field() directly will bypass WordPress’s image sizing code and should only be used if you have an explicit size that designers are cropping to in Photoshop. To…
Finding abandoned/no longer maintained plugins
After Matt’s State of the Word 2014 presentation I was talking to my host (QTH) about how Matt would like to encourage/pressure hosts into upgrading their PHP installs. My host told me that he’s tried this but it often results in broken sites because users don’t have their plugins updated…
Disable WordPress’s cron for XML-RPC requests
WordPress has a custom task scheduler that gets fired on every single request to a WordPress site. By “fired” I mean that every request involving WordPress causes a lookup to see if there are any tasks waiting to be run and if so runs them. The tasks are actually run by the…