This example illustrates how to query an array of post IDs from a custom DB table then use the array in a WP_Query.
This can be much faster than using meta queries on a WP_Query object, particularly if you are matching multiple fields.
<?php | |
/** | |
* Locates an ACF sub-field by field name and returns the sub-field's key. | |
* | |
* This is particularly useful if you need to construct a data array for programmatic field | |
* update where a complex field is in use (e.g; repeater, group, flexi). | |
* | |
* @param string $sub_field_name The sub field name we need a key for. | |
* @param array $field The ACF field array. |
.m-0-first-last > :first-child { | |
margin-top: 0; | |
} | |
.m-0-first-last > :last-child { | |
margin-bottom: 0; | |
} | |
<?php | |
add_action( 'wp_enqueue_scripts', function () { | |
$uri = get_stylesheet_directory_uri(); | |
$dir = get_stylesheet_directory(); | |
$script_last_updated_at = filemtime( "$dir/scripts/my-script.js" ); | |
$style_last_updated_at = filemtime( "$dir/styles/my-style.css" ); |
<?php | |
use ACFCustomDatabaseTables\Intercept\ACFGetFieldIntercept; | |
use ACFCustomDatabaseTables\Vendor\Pimple\Container; | |
/** | |
* Class ACFCDTvOneDotZeroDotAnyGetFieldInterceptBypass | |
* | |
* This provides a 'hotfixed' approach for disabling custom database table intercept when using ACF's get_field() | |
* function. This will only work with version 1.0.x versions of the plugin as a built-in tool will be available in |
<?php | |
add_filter( 'acf/fields/wysiwyg/toolbars', function ( $toolbars ) { | |
$toolbars['Bare'] = []; | |
$toolbars['Bare'][1] = [ 'forecolor', 'link', 'strikethrough', 'bold', 'italic' ]; | |
return $toolbars; | |
} ); |
<?php | |
add_filter( 'acf/settings/load_json', function ( $paths ) { | |
$paths[] = get_template_directory() . '/some/custom/dir'; | |
return $paths; | |
} ); |
<?php | |
// register a top-level options page | |
if ( function_exists( 'acf_add_options_page' ) ) { | |
acf_add_options_page( [ | |
'page_title' => 'My Options Page', | |
'menu_title' => 'My Options Page', | |
'menu_slug' => 'my-options-page', | |
'capability' => 'edit_posts', | |
'parent_slug' => '', |
<?php | |
add_filter( 'pre_option_elementor_maintenance_mode_mode', function ( $option ) { | |
$parameter = 'bypass_maintenance'; // change this to whatever you like | |
if ( isset( $_GET['bypass_maintenance'] ) and $_GET['bypass_maintenance'] ) { | |
return 0; // needs to be falsy but not FALSE | |
} |