custom field value is blank or empty

You need to pass the $post_id into the get_the_content() : function add_custom_fields($post_id) { global $post; $metadescription = wp_trim_words( get_the_content($post_id), 55 ); add_post_meta($post_id, ‘meta_description’, ” . $metadescription . ”, true); } add_action(‘wp_insert_post’, ‘add_custom_fields’);

Is there a way to read JSON data inside Custom Fields without editing PHP? [closed]

Yes. Use JSON.parse($string); to convert your string value to JSON format within Javascript. <script> var json_data_string = ‘{“data”:[“string no 1″,”string no 2″,”string no 3”]}’; // or echo the json_data field as <?php echo $json_data; ?> var json_data = JSON.parse(json_data_string); // Now access the properties as $data = json_data.data; // outputs: string no 1,string no 2,string … Read more

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