문제

I'm trying to make sortable columns in Sites and Links listings admin pages.

/wp-admin/network/sites.php and /wp-admin/link-manager.php

The problem is the following filters are not firing up in these screens, preventing the query modification. Is there other method that could be used?

function site_category_column_orderby( $vars ) {
    //global $firephp;
    //$firephp->log($vars, 'vars');
    if ( isset( $vars['orderby'] ) && 'site_category' == $vars['orderby'] ) {
        $vars = array_merge( $vars, array(
            'meta_key' => 'site_category',
            'orderby' => 'meta_value_num'
        ) );
    }
    return $vars;
}
add_filter( 'parse_query', 'site_category_column_orderby' );


function link_thumbnail_column_orderby( $vars ) {
    if ( isset( $vars['orderby'] ) && 'link_thumbnail' == $vars['orderby'] ) {
        $vars = array_merge( $vars, array(
            'meta_key' => 'link_thumbnail',
            'orderby' => 'meta_value_num'
        ) );
    }
    return $vars;
}
add_filter( 'request', 'link_thumbnail_column_orderby' );

[UPDATE]

I'd like to sort the a Link column for this plugin: https://wordpress.stackexchange.com/a/50389/12615

And the a Site column for this other one: https://wordpress.stackexchange.com/a/50936/12615

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top