In an environment without third party code, get_the_ID()
should give you the correct value. It sounds like some plugin is interfering with this.
So you can do what they forgot and simply call
wp_reset_postdata()
in your footer before you need the values.
Related Posts:
- Query multiple custom post types in single loop
- Inject post (from specific category) between posts in Loop
- Build a content and excerpt grid loop with paging and options for # of posts
- Alter secondary loop to exclude posts from current page category
- How to get to a specific position in wp_query?
- have_posts() execution failure
- Using foreach loop breaks
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- WP_Query fails despite having 1 post
- wp_query get the 2nd post
- How to get post ID in a Page?
- Display an image if odd number of posts in grid
- How to add div blocks after certain set of post
- How to overwrite orderby with add_query_var
- Get all posts as an array ID => Name
- WP_Query multiple post results
- Do not duplicate posts with multiple categories in multiple loops
- Infinite Loop – WP_Query
- Dividing the loop to style post differently
- How to extract information from a wp_query result?
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- Wp Query : Order by distance lat,lon
- Give ID to divs inside the loop
- in_array not working on dev server but works on localhost
- How to display sticky post always at the top (before regular post) in wordpress?
- Making list of posts with chosen description
- My query keeps looping infinitely ! how to stop it?
- Efficient way of querying for a “fallback” post?
- For each 3 posts, show a different post type
- Add post class in custom loop (WP_QUERY)
- Create a hierarchical loop at predefined markup requirements
- Advanced Taxonomy query, with 3 post types
- Why does a meta_query break this WP_Query?
- WordPress post pagination on custom template not working
- Pagination in category.php not functioning
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- after refresh the id that shows correct in first time click, changes to 1
- How do I exclude the current post from the upcoming post query
- How do I display WooCommerce products in my query to rows of 3?
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress
- Looping through WP_Post Object
- Display Post co-authored in Author Page
- Passing the page ID to a login php script
- How to exclude specific category from the get_the_category(); array
- Sorting Posts | Alphabetical Order
- spliting posts into two columns
- Looking for most performant way to execute several similar WP queries within shortcodes
- How to Display a Single Post Excerpt
- How to make sure content doesn’t display if selection is empty
- Changing layout with wp_customise
- How to use an associative array in post__in with WP_Query?
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- get author_name from queried post
- Exclude posts based on meta value
- post thumbnail, conditions, else wont work
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Why in my theme I can’t see all the statics content under the posts?
- Trouble inputting variable into WP query
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- Array to string conversion on array_map
- Target post_date_gmt if it’s empty or not set
- Why my loop isn’t working? [closed]
- How to get post ID from button and pass title to Modal
- Passing an array into WP_Query as a variable
- Custom query vars filters problem with pagination
- WordPress meta_query >= &
- Display child page content of a specific parent on home page
- php return username of currently viewed author profile
- WordPress loop is not working
- Displaying Event within two given time frames
- Remove Post if Advanced Custom Field is checked to fix paging
- WP_Query: How to get results from both meta_key options?
- Passing in MySQL prepare statement parameter separately throwing error
- Pagination contents not changing in Front page WordPress
- Load more posts using AJAX based on posts inside WP_Query
- Custom search query on WordPress page not working
- How to select post ID for given parent name with nested prepared queries?
- posts_per_page displays only 2 posts instead of 4 posts
- Where does php code to load data go?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Add code to the header of posts by particular author
- Paged WP_Query is quitting on page 3
- Get Child of Child Pages in custom Menu
- Latest posts feed with a specific post always first
- How to redirect (301) trashed post to it’s parent taxonomy TERM ARCHIVE instead of 404 page
- Meta query not showing result properly
- Help on Wp_query to print an term
- making a search.php query
- Loop 1 user randomly
- enumerating custom taxonomies?
- Query seems to be duplicated
- Pagenav Not appearing on custom Template
- Remove the_content From Loop
- Adding if statement to content for homepage
- Tables not showing divs and loop/php items
- Keeping the previous get value and add another value when submitted
- How to handle parent and child pages?
- How to create a loop that will display one post and stop?