Get Meta from Custom Field of Image URL

I can already tell that you’re using ACF – if you don’t want to change the return settings for the field, you can bypass ACF and just pull the image ID directly from post meta: $image_url = get_field( ‘my_field_name’ ); $image_id = get_post_meta( $post->ID, ‘my_field_name’, true ); $image_meta = wp_get_attachment_metadata( $image_id );

WP Query—Relationship between two custom post types and their fields

I haven’t tested this but it SHOULD work. You’ll want to put it in the single-staff.php. You’ll have to add the details (actual query, post types, etc). $reports = get_posts(array( ‘post_type’ => ‘reports’, //use actual post type ‘meta_query’ => array( ‘relation’ => ‘or’, array( ‘key’ => ‘primary_contact’, // name of custom field ‘value’ => ‘”‘ … Read more

Custom User Profile Fields

You’re going to definitely want to do this with a plugin. Modifying WordPress Core files is an extremely bad idea as others have pointed out because every update will wipe them out and future versions may change the location/function of what you’re editing. You can get away by adding it to the theme’s functions.php file … Read more

Customizer field value into functions.php variable

Sure, every setting in the Customizer is saved either as a theme mod (by default) or option (if you set the ‘type’ to ‘option’ in $wp_customize->add_setting()). You can access the user-defined value using get_theme_mod() (or get_option()). In your example, the value you are looking for can be retrieved with: $downloads_tab_text = get_theme_mod( ‘product-downloads-tab’ );

woocommerce product custom field

You should ad the custom field to product API response, try this (untested) add_filter( ‘woocommerce_rest_prepare_product’, ‘custom_products_api_data’, 90, 2 ); function custom_products_api_data( $response, $post ) { // retrieve a custom field and add it to API response $response->data[‘purchasing_cost’] = get_post_meta( $post->ID, ‘purchasing_cost’, true ); return $response; }

Redirect users based on custom field

According to your functions, if you want to redirect users when they are visiting the website’s homepage. You could implement the is_front_page() function to detect and only redirects if they are on the frontpage. function user_homepage() { if ( is_user_logged_in() ) { $args = array( ‘field’ => 25, ); $user_homepage = bp_profile_field_data( $args ); if … Read more