-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #651
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* Mai Engine. | ||
* | ||
* @package BizBudding\MaiEngine | ||
* @link https://bizbudding.com | ||
* @author BizBudding | ||
* @copyright Copyright © 2020 BizBudding | ||
* @license GPL-2.0-or-later | ||
*/ | ||
|
||
// Prevent direct file access. | ||
defined( 'ABSPATH' ) || die; | ||
|
||
add_filter( 'acf/is_field_key', 'mai_acf_is_field_key', 10, 2 ); | ||
/** | ||
* Checks if a field key is a valid ACF field key. | ||
* We need this because we wrongly used custom field keys that don't start with `field_`. | ||
* Our engine blocks use `mai_` and plugin blocks use `maicca_', `maipub_`, etc., so we check for `mai`. | ||
* | ||
* @since TBD | ||
* | ||
* @param bool $bool The result. | ||
* @param string $id The identifier. | ||
* | ||
* @return bool | ||
*/ | ||
function mai_acf_is_field_key( $bool, $id ) { | ||
// Bail if already true. | ||
if ( $bool ) { | ||
return $bool; | ||
} | ||
|
||
return $id && str_starts_with( $id, 'mai' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters