initial sort order for a sortable custom column in admin

Instead of adding your column label “view” as a string, pass it in as an array with 1 as the second value. Like this: array(‘view’,1) Full Code: add_filter( ‘manage_edit-post_sortable_columns’, ‘my_sortable_view_column’ ); function my_sortable_view_column( $columns ) { $columns[‘post_views’] = array(‘view’,1); return $columns; } I don’t have a WP Codex for this, but I found someone else … Read more

Add new column to sites page

here is a modified version of your class that should work: class Add_Blog_ID { public static function init() { $class = __CLASS__ ; if ( empty( $GLOBALS[ $class ] ) ) $GLOBALS[ $class ] = new $class; } public function __construct() { add_filter( ‘wpmu_blogs_columns’, array( $this, ‘get_id’ ) ); add_action( ‘manage_sites_custom_column’, array( $this, ‘add_columns’ ), … Read more

Modify column_author in WP_Comments_List_Table

This is how the email part is displayed by the WP_Comments_List::column_author() method: /* This filter is documented in wp-includes/comment-template.php */ $email = apply_filters( ‘comment_email’, $comment->comment_author_email, $comment ); if ( ! empty( $email ) && ‘@’ !== $email ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/258903/%1$s”>%2$s</a><br />’, esc_url( ‘mailto:’ . $email ), esc_html( $email ) ); } so you’re … Read more

sortable custom column in media library

You cannot do a sort on the attachment meta data specifically because it’s stored in a serialized string. Whilst WP_Query can sort on meta values it can’t sort on data that’s serialized. For example wp_get_attachment_metadata fetches and unserializes that for you inside the column callback, but MySQL queries can’t sort on that type of data. … Read more

Custom sortable columns ordered by meta-value?

It’s because you are checking ‘event_date’ == $vars[‘event_date’] not ‘event_date’ == $vars[‘orderby]. But don’t use the request filter. Instead: add_action( ‘pre_get_posts’, ‘event_column_orderby’ ); function event_column_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); if( ‘event_date’ == $orderby ) { $query->set(‘meta_key’,’_wr_event_date’); $query->set(‘orderby’,’meta_value_num’); } } … and don’t manually set the order as … Read more

Custom column for changing post status via ajax

here you go: <?php /* Plugin Name: ajaxed-status Plugin URI: http://en.bainternet.info Description: answer to : Custom column for changing post status via ajax http://wordpress.stackexchange.com/questions/33442/custom-column-for-changing-post-status-via-ajax Version: 1.0 Author: Bainternet Author URI: http://en.bainternet.info */ if ( !class_exists(‘ajaxed_status’)){ class ajaxed_status { //constarctor public function __construct() { global $pagenow,$typenow; //&& $typenow ==’page’ if (is_admin() && $pagenow==’edit.php’){ add_filter(‘admin_footer’,array($this,’insert_ajax_status_script’)); } add_filter( … Read more

Custom columns on edit-tags.php main page

You can do this by hooking into the ‘taxonomy’_edit_form and edited_’taxonomy’ actions. add_action(‘taxonomy_edit_form’, ‘foo_render_extra_fields’); function foo_render_extra_fields(){ $term_id = $_GET[‘tag_ID’]; $term = get_term_by(‘id’, $term_id, ‘taxonomy’); $meta = get_option(“taxonomy_{$term_id}”); //Insert HTML and form elements here } add_action(‘edited_taxonomy’, ‘bar_save_extra_fields’, 10, 2); function bar_save_extra_fields($term_id){ $form_field_1 = $_REQUEST[‘field-name-1’]; $form_field_2 = $_REQUEST[‘field-name-2’]; $meta[‘key_value_1’] = $form_field_1; $meta[‘key_value_2’] = $form_field_2; update_option(“taxonomy_{$term_id}”, $meta); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)