You need to pass $postid
to your get_field
function.
<?php
$value = get_field( "employee_category", $postid );
if( $value ) {
echo $value;
} else {
echo 'empty';
}
?>
See docs: https://www.advancedcustomfields.com/resources/get_field/
Related Posts:
- Order posts by custom field and if custom field is empty return remaining posts
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- How do I exclude posts by custom field value?
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- Loop to display random posts only if a custom field matches category
- 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
- Accessing loop functions (e.g the_title or the_content) from post ID
- Limit the number of acf content when displaying in post loop [closed]
- 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
- 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
- Efficiently sort only certain categories by custom field
- 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
- Loop through incrementing custom fields
- do_shortcode close
- Search Results Page – Displaying Custom Meta Fields
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- Collect Data from NEXT item while in loop
- How to show content of custom fields in search results?
- 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
- Filter or order based on custom field
- Compare ACF date field (if exists) and post date and order DESC
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- User Filter Options on Archive Page
- 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?
- Get meta value when the page is a blog archive
- WP_query returns error when used for custom widget
- I want my post to republish again after adding a custom field
- Display posts where date field matches current month?
- 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 enable custom fields for pages (if not a bad practice)?
- Add a Jquery Datepicker to custom field in post edit
- Custom per-page sidebar widgets .. possible?
- Guest Author – How can I use custom fields to create guest author link?
- Create additional short URL with custom field and 301 redirect
- enabling custom fields in admin?
- get_post_meta fields don’t show up on posts page
- Using custom fields in a filter hook
- Function to change meta value in database for each post
- How to Identify the Source of a Custom Field?
- Include woocommerce custom field value in front-end search result
- Custom Fields with get_post()
- How do you create dynamic customised sections in WordPress?
- how can i stop custom fields that have apostrophes from breaking my code
- how do i remove posts from a WP_Query so the pagination is right?
- How can I store a file in the database in the same way WordPress and ACF do?
- Custom Field Create Bulk via SQL Query
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Custom fields value
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- More efficient to add content to custom fields or the content area?
- Custom field query without duplicates results
- how to display an excerpt of the latest post on the homepage?
- querying a custom field
- Custom post type missing custom fields
- If metabox has content display content
- How to change permalink on headlines in rss feeds?
- Listing the most popular 8 city (custom fields) as used in posts
- How to delete file uploaded by Plupload
- Displaying custom field meta within WP_query loop
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Delete user meta but only if found in array
- Metabox/Custom fields are not saving input data
- meta_query to check all custom fields
- Order categories by sum of custom fields
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Saved Post Meta Array Returns as String
- Thirtieth century date for a post
- Custom field in external Javascript
- Analyze uploaded images to get colour values
- Turn Current Date in Custom Field Ouput Green or Red
- list pages by custom_field?
- Get custom field from page, in a post?
- Make Custom Fields Public in JSON – API
- Dynamically update Custom Fields to display new dates