php Asignar campos是一个una categoria padre

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Asignar campos是一个una categoria padre相关的知识,希望对你有一定的参考价值。

/**
 * Tests if any of a post's assigned categories are descendants of target categories
 *
 * @param int|array $cats The target categories. Integer ID or array of integer IDs
 * @param int|object $_post The post. Omit to test the current post in the Loop or main query
 * @return bool True if at least 1 of the post's categories is a descendant of any of the target categories
 * @see get_term_by() You can get a category by name or slug, then pass ID to this function
 * @uses get_term_children() Passes $cats
 * @uses in_category() Passes $_post (can be empty)
 * @version 2.7
 * @link http://codex.wordpress.org/Function_Reference/in_category#Testing_if_a_post_is_in_a_descendant_category
 */
if ( ! function_exists( 'post_is_in_descendant_category' ) ) {
    function post_is_in_descendant_category( $cats, $_post = null ) {
        foreach ( (array) $cats as $cat ) {
            // get_term_children() accepts integer ID only
            $descendants = get_term_children( (int) $cat, 'category' );
            if ( $descendants && in_category( $descendants, $_post ) )
                return true;
        }
        return false;
    }
}


wp-content/plugins/advanced-custom-fields/core/controllers/location.php

Line 566-569 to:

if( in_array($rule['value'], $terms) || post_is_in_descendant_category( $rule['value'], $options['post_id'] ) )
{
    $match = true; 
}

以上是关于php Asignar campos是一个una categoria padre的主要内容,如果未能解决你的问题,请参考以下文章

sql Ejemplodeactualizacióndeun campo de un tabla tomando el valor de un campo de una tabla dife

sql MySQL:Conceder特权与una o varias tablas y campos。来自:https://www.sitepoint.com/community/t/mysql-per

php 野外身体recortar campo一个X caracteres。

php Convertir los campos a campos obligatorios enlapáginadefinalizar compra

php esconder campos做结帐

php Adicionar campo结账