wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
_wp_get_abilities_match_meta is private and should not be used in themes or plugins directly.
_wp_get_abilities_match_meta › WordPress Function
Desde7.1.0
Obsoleton/a
› _wp_get_abilities_match_meta ( $meta, $conditions )
| Acesso: |
|
| Parâmetros: (2) |
|
| Retorna: |
|
| Definido em: |
|
| Codex: |
Checks whether an ability's meta array matches a set of required key/value conditions.
All conditions must match (AND logic). Supports nested arrays for structured meta, e.g.array( 'mcp' => array( 'public' => true ) ). Every condition key must exist,
and non-array values are compared strictly, including their types. Extra meta keys
are allowed at any level.Funções relacionadas: wp_get_abilities, wp_get_ability_category, wp_image_file_matches_image_meta, wp_get_attachment_metadata, wp_get_ability
Fonte
function _wp_get_abilities_match_meta( array $meta, array $conditions ): bool {
foreach ( $conditions as $key => $value ) {
if ( ! array_key_exists( $key, $meta ) ) {
return false;
}
if ( is_array( $value ) ) {
if ( ! is_array( $meta[ $key ] ) || ! _wp_get_abilities_match_meta( $meta[ $key ], $value ) ) {
return false;
}
} elseif ( $meta[ $key ] !== $value ) {
return false;
}
}
return true;
}