If you want the image URL you should use wp_get_attachment_image_url()
, not wp_get_attachment_image()
:
$background_image_id = get_post_meta(get_the_ID(), 'your_background_image_id', true);
$background_image = wp_get_attachment_image_url( $background_image_id, 'full' );
$profile_image_id = get_post_meta(get_the_ID(), 'your_profile_picture_id', true);
$profile_image = wp_get_attachment_image_url( $profile_image_id, 'full' ); ?>
wp_get_attachment_image()
returns a full HTML <img>
tag, but background images are just a URL.
Related Posts:
- How Can I save multiple records in same meta key?
- Custom fields for custom post type
- Show posts from WP Custom Post Type selected from a field in a metabox
- Querying meta values within an array
- Check for custom field value in different post type than current one and do something
- Query custom fields with three dates – start and end does not work
- meta_query compare >= not working but
- Metadata for a taxonomy – is there any WordPress way of doing this?
- List all images from a single post meta value
- Populate Custom Fields in a Custom Post Type?
- Insert Multiple Post with Same Publish Button
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Meta Key Value in current-user-only loop
- How to check if user meta field is empty in conditional else statement
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Get posts between custom dates
- Give a permalink to Custom Post Types without title
- How to implement a Google map store locator
- Posting to a Custom Post Type from front end – user generated content
- Update Post Meta for a logged in user
- Getting meta in editor plugin, and event triggering issue
- Orderby CPT custom fields not working
- A better way to add a meta box to custom post types
- Two Custom Post Types Many to Many Relationship
- get_post_meta not working on publishing
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- How to use TinyMCE Editor for one of my custom post meta field?
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- Importing Data from a Non-WordPress database, into WP
- custom comments form for custom post type
- filter search custom field query
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Check if post with same meta value exists
- Custom post type’s extra fields – how to handle?
- Send a conditional email notification when a custom field value changes in Post Type
- Submitting Custom Post Types with custom fields from Front-end form
- create custom meta box with default value
- ACF in wordpress
- delete_post_meta() for whole CPT / multiple posts?
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query of custom post type sorted by meta_key has unexpected results
- copy images from custom field to another custom field
- Custom Query: If One Post Object Field Value Is The Same As Another
- How to show custom field on specific custom post type posts only when filled
- Custom post type in Custom widget – $listItem
- Cannot obtain custom meta information
- Problem with adding custom post type meta to header by plugin
- How can I output WPAlchemy repeating fields meta values in my page template?
- How to call a post’s metadata in shortcode.php?
- Generating and downloading files with WP API
- WP_Meta_Query object with conditionals
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- updating one custom meta field only
- Add a class to post_class if more than one post shares same meta_value_num
- Fill custom fields when saving custom post types
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Writing a custom Glossary plugin
- Filter search posts by post meta?
- Mandatory field in Custom post
- Custom fields for post or terms which don’t update on post update
- order the meta query results by 2 custom fields
- How to store the third party script with HTML code in the wordpress custom input field?
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- Using OR relation in meta_query to check for a value before sorting by another
- How to upload an image to a custom post type
- How to keep custom post type related information
- Meta query and compare “!=” not working as expected
- Orderby if between two meta fields
- How to select meta key in custom database query
- Use WP_query to match post types based on custom field values
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Where is get_post_meta value located?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Show Post columns to specific users on condition
- Custom post types – meta_query: search lesson which starts sooner
- Error when moving custom post type to bin
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Run query on specific admin options page and send results to select field in another function
- Meta_query by date for Events archive
- Custom post type that lets users create a set of posts?