User Last Login Sort Column

I don’t see anywhere in your code that the query is being modified. Just flagging a column to be sortable doesn’t mean it knows how to sort the data – it will just add the little up/down arrow and make the column clickable but you have to intercept the query var accordingly and tell WP … Read more

manage_posts_custom_column, showing serial number using increment in loop

This code will add an Index value to each post which is determined by $wp_query->current_post, the number of posts per page, and the current page being viewed. add_filter( ‘manage_posts_columns’, ‘wpse240648_manage_posts_columns_index’); function wpse240648_manage_posts_columns_index($columns) { $columns[‘index’] = __( ‘Index’, ‘your-text-domain’ ); return $columns; } add_action( ‘manage_posts_custom_column’, ‘wpse240648_manage_posts_custom_column_index’, 10, 3 ); function wpse240648_manage_posts_custom_column_index( $column, $post_id ) { if … Read more

Calculations in functions.php [closed]

On those lines get_post_meta() will return an array because by default the third argument of get_post_meta() is false. If you want to return a single value you should call it like so: get_post_meta( get_the_ID(), ‘invoice_service_amount’, true ); Additionally, you may want to get the post meta first and then ensure you have a value (wrapping … Read more

Problem adding column to WC Subscription [closed]

Alright, so since WC Subscriptions is creating it’s own array for columns. Any filter priority lesser than their function will simply make your code non-functional. So what I did is I changed priority from 10 to 1000 so that my codes fire after their code. add_filter( ‘manage_shop_subscription_posts_columns’, function ($columns) { $columns[‘my_field’] = __(‘My Field’); return … Read more

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