term_exists example

        $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
    }

    if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) {
        $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
    } else {
        $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
    }

    $join = '';
    if ( $args['category'] && 'post' === $args['content'] ) {
        $term = term_exists( $args['category'], 'category' );
        if ( $term ) {
            $join   = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
            $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
        }
    }

    if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) {
        if ( $args['author'] ) {
            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
        }

        


    $taxonomy_object = new WP_Taxonomy( $taxonomy$object_type$args );
    $taxonomy_object->add_rewrite_rules();

    $wp_taxonomies[ $taxonomy ] = $taxonomy_object;

    $taxonomy_object->add_hooks();

    // Add default term.     if ( ! empty( $taxonomy_object->default_term ) ) {
        $term = term_exists( $taxonomy_object->default_term['name']$taxonomy );
        if ( $term ) {
            update_option( 'default_term_' . $taxonomy_object->name, $term['term_id'] );
        } else {
            $term = wp_insert_term(
                $taxonomy_object->default_term['name'],
                $taxonomy,
                array(
                    'slug'        => sanitize_title( $taxonomy_object->default_term['slug'] ),
                    'description' => $taxonomy_object->default_term['description'],
                )
            );

            

function is_term( $term$taxonomy = '', $parent = 0 ) {
    _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
    return term_exists( $term$taxonomy$parent );
}

/** * Determines whether the current admin page is generated by a plugin. * * Use global $plugin_page and/or get_plugin_page_hookname() hooks. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 1.5.0 * @deprecated 3.1.0 * * @global $plugin_page * * @return bool */

function category_exists( $cat_name$category_parent = null ) {
    $id = term_exists( $cat_name, 'category', $category_parent );
    if ( is_array( $id ) ) {
        $id = $id['term_id'];
    }
    return $id;
}

/** * Gets category object for given ID and 'edit' filter context. * * @since 2.0.0 * * @param int $id * @return object */
Home | Imprint | This part of the site doesn't use cookies.