Custom field as featured image caption

Here’s one way to inject the custom field as the featured image caption with help of the post_thumbnail_html filter: add_filter( ‘post_thumbnail_html’, function( $html, $post_id ) { if( $html && $caption = get_post_meta( $post_id, ‘wpcf-bildunterschrift’, true ) ) $html .= sprintf( ‘<p>%s</p>’, sanitize_text_field( $caption ) ); return $html; }, 10, 2 ); Hopefully you can adjust … Read more

Display custom field from the front page on another page

$val = get_post_meta( get_the_ID(), ‘meta_data_name’, true ); echo $val; You can replace get_the_ID() with the ID of the post you are getting the meta from. You could possible team this with: $frontpage_id = get_option(‘page_on_front’); to get the homepage ID. Not sure if this would be friendly with multisite though. the_field() is an Advanced Custom Fields … Read more

How to update user profile custom fields

I use update_user_meta to update the fields. You can add this in functions.php of your child theme. function save_extra_user_profile_fields( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) ) { return false; } update_user_meta( $user_id, ‘telephone’, $_POST[‘telephone’] ); } add_action( ‘personal_options_update’, ‘save_extra_user_profile_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_extra_user_profile_fields’ );

Custom Fields not showing up for custom post type

If you have created an Class in your plugin then you should use the action hook for admin_init in class only just like you have used “init” function __construct() { add_action( ‘init’, array( $this, ‘register_custom_post_type’ ) ); add_action( ‘admin_init’, array( $this, ‘add_artbeat_meta_boxes’ ) ); add_action( ‘save_post’, array( $this, ‘save_artbeat_custom_fields’ ) ); } Hope this will … Read more

How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]

For anyone who needs help with this, here’s my solution. With the Gravity Forms hooks gform_pre_render, gform_pre_validation, gform_pre_submission_filter and gform_admin_pre_render I was able to populate the dropdown fields with dynamic data. Despite this is not too user friendly, we can define specific CSS classes to have this done and avoid populate fields that we don’t … Read more