Custom field as meta description

If you want to fetch the data from a custom field named wpse_desc: then here’s one way to do that with your code snippet: function wpse_custom_meta_description() { // Nothing to do if ( ! is_single() ) return; // Fetch our custom field value $desc = get_post_meta( get_queried_object_id(), ‘wpse_desc’, true ); // Output if( ! empty( … Read more

Keep display metadata value on backend – Custom Metabox

Modify your news_date() function to be as follows: function news_date( $post ) { wp_nonce_field( plugin_basename( __FILE__ ), ‘news_date_content_nonce’ ); // get the current value of ‘news_date’ to use in the <input> $value = get_post_meta ($post->ID, ‘news_date’, true) ; echo ‘<input type=”text” id=”news_date” name=”news_date” placeholder=”Enter Date” value=”‘ . $value . ‘”/>’; } Another suggestion would be … Read more

How I can get custom field’s current value?

The author of plugin help me with that. Thanks all. global $post; $product_colors = get_the_terms( $post, ‘product_color’ ); $saved_colors = get_option( ‘nm_taxonomy_colors’ ); if(isset($product_colors) && is_array($product_colors)){ foreach($product_colors as $color){ $term_id = $color->term_id; $hex_code = $saved_colors[$term_id]; echo $hex_code . ‘<br />’; } }