How to change the default orderby from “Date” to e.g. “Title” or my custom column in content type records list in admin?

pre_get_posts the right hook you need to use. function CPT_set_default_orderby($q){ global $pagenow, $typenow; if( is_admin() && ‘edit.php’ == $pagenow && ‘post’ == $typenow && !isset($_GET[‘orderby’]) ){ // to order by title $q->set(‘orderby’, ‘title’); // to orderby with meta key $q->set(‘orderby’, ‘meta_key’); $q->set(‘meta_key’, ‘expiration’); } } add_action(‘pre_get_posts’, ‘CPT_set_default_orderby’);

title tag for custom post type remove taxonomy name from title tag

I believe that WPPizza Categories is coming from ‘name’ => _x( ‘WPPizza Categories’, ‘taxonomy general name’ ) And your url problem is coming from not setting a slug. For example: ‘rewrite’ => array( ‘slug’ => ‘pizza_categories’, ‘with_front’ => false ), You need to replace the slug with something else, as you need something in place … Read more

Updating custom post meta with ajax

If you load a file directly none of the WordPress functions will work. That is why you should nearly always use the AJAX API. The AJAX API solves this problem. Everything loads in WordPress context. You would wrap your processing PHP is a function: function my_ajax_cb_wpse_108143() { $cote = get_post_meta($_POST[‘id’], ‘cote’, true); if($_POST[‘cote’] == ‘like’) … Read more