wp_get_link_cats example


        do_action( 'manage_link_custom_column', $column_name$item->link_id );
    }

    public function display_rows() {
        foreach ( $this->items as $link ) {
            $link                = sanitize_bookmark( $link );
            $link->link_name     = esc_attr( $link->link_name );
            $link->link_category = wp_get_link_cats( $link->link_id );
            ?> <tr id="link-<?php echo $link->link_id; ?>"> <?php $this->single_row_columns( $link ); ?> </tr> <?php         }
    }

    /** * Generates and displays row action links. * * @since 4.3.0 * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support. * * @param object $item Link being acted upon. * @param string $column_name Current column name. * @param string $primary Primary column name. * @return string Row actions output for links, or an empty string * if the current column is not the primary column. */

function get_linkcatname($id = 0) {
    _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );

    $id = (int) $id;

    if ( empty($id) )
        return '';

    $cats = wp_get_link_cats($id);

    if ( empty($cats) || ! is_array($cats) )
        return '';

    $cat_id = (int) $cats[0]; // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}

/** * Print RSS comment feed link. * * @since 1.0.1 * @deprecated 2.5.0 Use post_comments_feed_link() * @see post_comments_feed_link() * * @param string $link_text */

function wp_link_category_checklist( $link_id = 0 ) {
    $default = 1;

    $checked_categories = array();

    if ( $link_id ) {
        $checked_categories = wp_get_link_cats( $link_id );
        // No selected categories, strange.         if ( ! count( $checked_categories ) ) {
            $checked_categories[] = $default;
        }
    } else {
        $checked_categories[] = $default;
    }

    $categories = get_terms(
        array(
            'taxonomy'   => 'link_category',
            
Home | Imprint | This part of the site doesn't use cookies.