Custom Admin Post Column change order

Thanks to @cameronjonesweb’s link, here’s the code you might use: add_filter( ‘manage_edit-post_sortable_columns’, ‘my_add_sortable_custom_column’); function my_add_sortable_custom_column( $columns ) { $columns[‘views’] = ‘views’; return $columns; } add_action( ‘pre_get_posts’, ‘my_sort_custom_column’ ); function my_sort_custom_column( $query ) { if( ! is_admin() || ! $query->is_main_query() ) { return; } if ( ‘views’ === $query->get( ‘orderby’) ) { $query->set( ‘orderby’, ‘meta_value’ ); … Read more

How to detect if an ACF custom-field is really in use?

Most sensible here is probably just a custom query global $wpdb; $sql_find_meta = “SELECT post_id FROM database_name_here.wp_postmeta WHERE meta_key = ‘my_special_value’ AND meta_value > ”;”; // > ” == not null, whitespace or blank $posts_with_meta_key = $wpdb->get_col( $sql_find_meta ); foreach ( $posts_with_meta_key as etc….. You can repeat this for wp_termmeta and term_id

WP Rest API feature image breaking react component

Resolved! If no feature image exists, then _embedded[‘wp:featuredmedia’] is not used. To resolve, the prop value needs to be wrapped into a conditional. <Post key={post?.id} id={post?.id} title = {post?.title.rendered} link = {post?.link} img = {post && post._embedded && post._embedded[‘wp:featuredmedia’] ? post._embedded[‘wp:featuredmedia’][0].source_url : ‘ ‘ } category = {post?.categories} />

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