You’ve got a missing )
and you’re passing true as a string and not a boolean value. So this line:
$pName = get_post_meta($post->ID, $productName, 'true';
Should in fact be:
$pName = get_post_meta($post->ID, $productName, true);
In light of your update why not do something like:
echo 'Product Name: '. $pName['productName'][0];
echo 'Location: '. $pName['locationName'][0];
echo 'Address: '. $pName['locationAddress'][0];
However this code will need to be improved and is maybe a question for stackoverflow as it’s not specific to WordPress. This is PHP and dealing with arrays/multidimensional arrays
Related Posts:
- How to show content of custom fields in search results?
- Using meta query (‘meta_query’) with a search query (‘s’)
- Including custom fields in search?
- Custom search: by post data and post metadata?
- Need small coding with Custom Fields Search
- Search ONLY by meta key / meta values
- Filter results with custom field values and dropdown
- Add custom field (value) to search result (without plugin)
- Is there a way to do multiple ordering on a multiple meta_query?
- searching in custom meta field
- Order posts by custom field and if custom field is empty return remaining posts
- WordPress Search Custom Meta Field Only
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- Extend ‘The Events Calendar’ search to include custom fields [closed]
- Include woocommerce custom field value in front-end search result
- Including Database Generated Pages in Site Search [closed]
- How do I exclude posts by custom field value?
- Echo values from custom field outside loop php
- Adding Custom Fields to Search
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- sort search results by custom fields using dropdown
- Using a checklist to search against metadata
- Loop to display random posts only if a custom field matches category
- Custom Fields Not in Search Results
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- How make a custom search on backend in WordPress without plugin?
- filtering custom post types via meta data drop down
- Limit the number of acf content when displaying in post loop [closed]
- Advanced search by two criteria – sort by location and date (ascending or descending)
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Advanced search for meta fields
- Merge Multiple Custom Fields into one New Custom Field for Searching
- Is there a better way to list all database terms alphabetically?
- Change the main loop WordPress impact on the server?
- custom-meta-box checkboxes from loop won’t save
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- How to populate custom field dropdown box based on prior selection?
- filter custom field values $min $max
- Restrict WordPress Search to Custom Field
- How can you include custom post meta in search without calling each key?
- Custom Fields – How to create a list from multi-line entries of a single value
- how to make nsfw post with thumbanil
- Custom Query based on custom field of a single post
- Can I access a post meta field before the loop?
- Displaying page image in the footer automatically
- Show image if author meta (profile fields) exists outside loop
- Can’t query by meta_key
- ul list with only as many li’s as filled custom fields
- Include one custom field in search results
- Loop through incrementing custom fields
- Custom search SQL Query to add custom field in result
- do_shortcode close
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- Custom field Search with Relavanssi
- Collect Data from NEXT item while in loop
- How to exclude custom fields from search queries?
- Custom field outside the loop and inside an array
- Display metabox title for custom fields with values
- use custom field value as post category in loop
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Filter or order based on custom field
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- Compare ACF date field (if exists) and post date and order DESC
- Type character in name and make it invisble
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- Search & column order by meta value in admin
- search based on custom field
- Very large list of options for BuddyPress profile fields
- User Filter Options on Archive Page
- searching by keywords in post’s metas or pagination links problem
- Search fails when using the radio buttons
- Custom meta boxes – add php code inside?
- get wordpress post loop by meta box date
- Outputting custom field on home.php not outside of blog list
- Counting number of images from loop
- Metabox value for post loop?
- Admin – Search Events by a custom field
- Get meta value when the page is a blog archive
- Search one custom field?
- Create custom query for search?
- Query postmeta values, and return multiple post_titles for common meta value
- Custom search (wp query by custom fields)
- WP_query returns error when used for custom widget
- Help sorting by Meta Key value
- I want my post to republish again after adding a custom field
- Display posts where date field matches current month?
- Custom search with meta fields
- Filtering posts by WORD in custom field
- Retrieve IDs from custom field, count and display results differently according to count
- Pagination not displaying correct number of pages
- Display custom field outside the loop
- Custom field not showing
- Order by a meta field in query loop
- How to display search query as formatted text?
- Search for meta_query does not return any result if combined with title