Automatically add custom fields value to wordpress post

I think update_post_meta( $post_id, ‘HD’, $mydata ); has its arguments in the wrong order and should be update_post_meta( $post_id, ‘quality’, ‘HD’); Alternatively where you need the custom field and it does not exist, why not just use “HD” as a default value? e.g. global $post; $theQuality = empty(get_post_meta( $post->ID, ‘quality’) ? ‘HD’ : get_post_meta( $post->ID, … Read more

Get all attachment by post excluding featured and content inside

I have solved. The solution is related with the function get_post_meta(); As WordPress as made by the abstraction of differnet kind of posts with the same structure we can define different post types. Here we can find more information about the function: https://developer.wordpress.org/reference/functions/get_post_meta/ And as you can read, you can find 3 vars $post_id, $key … Read more