WooCommerce: write featured image dimensions to custom fields in product’

The key here is to use the save_post hook and have it only run the code when the post type is product (or whatever your product post type is). Here’s the code — I made the assumption that you want the full size of the featured image: add_action( ‘save_post’, ‘save_product_featured_image_dimensions’ ); function save_product_featured_image_dimensions( $post_id ) { … Read more

How to get a database field value from a WordPress table? [closed]

In the first two cases, there’s an array wrapping the object that you have to attend to first. e.g. this should work: $status = $user[0]->status; As a sidenote: In the last case, json_encode() doesn’t, as the name might suggest, turn data into an object with properties that you can access — it turns it into a … Read more