I think I have seen this problem before and you need to set global $post;
on the line before to be able to use setup_postdata($post);
as it does not return the $post
object, but rather sets it in the global scope.
Related Posts:
- functions.php inject inline css
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Editing or filtering the output of the Genesis navigation
- How to use max and min values of custom fields
- Retrieve tags data in post body
- Run function when WordPress new multisite is created or ACF field is updated
- Having issues with a foreach inside of a shortcode with ACF gallery
- Get Current Post ID in functions php, meta query filter
- ACF not showing
- if statement for wordpress default featured image on single post
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- Add php code to wp_print_scripts?
- Access category within rss2_head hook?
- Can set_post_thumbnail be used to remove a thumbnail?
- get_next_posts_link() returns no result despite available posts
- Programmatically add Yoast meta description after post save
- Compare meta key to current date in pre get post
- Genesis Framework: How to exclude a specific author from archive custom loop
- Insert a field with PREG_REPLACE – strange behaviour
- Perform function on publish AND save (not just save)
- Display ACF category image on archive and single template files
- Featured Image and Tags problem
- Override a Post’s URL with Advanced Custom Fields Function
- WordPress Function Assistance with Loop
- How to show ACF value under post/page title in wp-admin
- How to display an image before title text in menu items
- Filter works on last selection but no others
- How to update an image attachment’s alt text from a custom field when saving a post?
- Help with with my function for wordpress
- ACF Date Form in Custom Admin Field
- Assign IDs to headings in ACF using functions.php
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- get_field() with ID in one signal filter not working
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Comment function for page
- ACF Filter return value
- Return ACF Field value function
- Providing fallback function and allow override by plugin
- Different body image backgrounds on different pages, posts and categories
- update_post_meta not working in function
- Syling Custom Fields echo’s from from functions.php
- does acf_save_post cause endless loop?
- Call ACF data from functions.php [closed]
- Update post meta with wp cron
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Relative URLs and hide /wp-content/themes/
- Check if the user has explicitly set an excerpt
- Slugs as breadcrumbs for Pages
- Shortcode with custom content attribute?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automatically add author’s name to post_tag
- Print Dashboard menu name and link
- Remove_filter (‘the_content’, ‘wpautop’) is not working
- Develop function get_template_part in functions.php
- Change comment_reply_link URL
- Ajaxing function in widget class
- How can you limit srcset on a single type of page?
- How to fix Warning: call_user_func_array()?
- wp_register_script(… $in_footer = true) not working
- I want to get product attirbute in the section below
- Restore Image Title Text
- ACF: how do I get the fields and its values of a specific group?
- Output and filter data from a XML url
- How do I create a function that simulate the click on Update button for all posts?
- Full page template function
- Redirect from “private” page and functions.php which tag add to add_action()?
- Display gallery on bottom after content
- WordPress listen to $_POST in functions.php
- Add Element as a Filter to the_content
- Can’t properly set the_title add_filter to show short_URL
- WordPress function, Run using Crontab
- Check if the image size is available and if not use ‘full’ image size
- Tags break custom Excerpt function
- issue with if/elseif in_array inside foreach loop display only one post
- wp_usermeta – Read from database, but save function broken
- remove/hide wp-editor
- Problems with functions.php! Error! [closed]
- Output comment_author in array
- Problem with shortcode inside a shortcode
- Is there anyway to force is_singular() to be true when not loading template?
- wp_title() return random number
- Postback redirect through add_action is not triggered
- How to add class dynamically from templates
- How to change form action of wp-login page with a function
- How to add link rel tags on paginated posts?
- How to pass data from a plugin to functions.php
- How to make an If Else on Excerpt Filter
- Translation Function missing text-domain [closed]
- Custom taxonomy not refreshing page on add
- Pagination in Search result
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Changing functions.php and .htaccess files
- Shortcode Variations?
- How to test for a class (from a plugin) in functions.php
- Sessions in word press [duplicate]
- “woocommerce_output_related_products” not working
- Different ads on every website on multisite environment
- How to get variable from other function inside class function using add_action for Ajax call