Turns out that there is just a small change to the way $page variable is set and the way the pagination links need to be written out.
the variable of page needs to be updated to paged and in the pagination array
page/ needs to be prefixed to %#%
Corrected example below.
Hope this helps someone with the same issue in the future.
if( get_query_var('paged') ) {
$page = get_query_var( 'paged' );
}
<?php // Pagination
echo paginate_links( array(
'base' => get_permalink() . 'page/%#%' . '/#gallery',
'format' => '?page=%#%',
'current' => $page,
'total' => $pages
) );
?>
Related Posts:
- Remove Post if Advanced Custom Field is checked to fix paging
- Sort by page information by Ascending Numbers
- PHP code to use on next & previouspage links
- Pagination for custom shop loop woocommerce
- Advanced Custom Fields – display label and value only if value entered
- Advanced Custom Fields not displaying
- How to get all author posts outside of author templates
- How to create pagination for users list using custom array?
- Download PDF after CF7 form submission
- Custom Pagination is Broken
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- Pagination on Custom Post
- Next post link on a bootstrap button
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Prev/Next Links Broken on Static Front Page Pagination
- Upload non-featured image to image field
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- the_posts_pagination() not working in wpquery
- HTML Special Characters in URL string [closed]
- ACF put a comma after the last repeater field value [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Form search query – displaying ACF “Post Object” field as results
- InnerBlocks with allowedBlocks not working with acf_register_block
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- ACF & Bootstrap Gallery Shows Blank Slides [closed]
- Conditional multidimensional arrays and array_map
- How can I count ACF sub_field with a certain value
- Generating rel=”prev” and rel=”next” using filters
- what is the method to echo class attribute inside the i tag? [closed]
- Need help with Code Correction php+wordpress
- Custom query vars filters problem with pagination
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Refactoring long if/else php chains
- Getting taxonomy category Image from ACF [closed]
- Need help with pagination
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Show get_sub_field value if it exists [closed]
- Update post meta – Custom field does not match meta-key
- Advanced Custom Fields [closed]
- Custom pagination (Previous / Next)
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- WordPress pagination not working in search result page
- Including Custom fields within the_content
- Get All In One SEO Pack to use custom field instead of Content
- How to add PHP pagination to wordpress
- pagination broken – clicking next displays “page not found”
- page 1 is not paged
- Pagination stays on same page for post category
- Pagination Not Working (pages duplicating content)
- Update user repeater meta (ACF) with another user meta field value
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Add class to all img if they have a certain ACF field
- Pagination in single.php
- Pagination at category doesnt work with same name of page
- Foreach loop is unexpectedly outputting an extra empty a tag
- Delete images from media library when user deletes an image from ACF Gallery
- How to work Woocommerce pagination inside shortcode?
- How to store checkbox data for individual users?
- Problems updating nested ACF field groups
- Help to modify wp_link_pages()
- Display acf taxonomy attachment
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- Nested Queries of decreasing specificity
- Get main parent category for post (WordPress/Advanced Custom Fields)
- Pagination contents not changing in Front page WordPress
- ACF: Display Google Map in frontend issues
- Bootstrap 4 Carosuel with ACF Repeater field
- Load more posts using AJAX based on posts inside WP_Query
- How to display acf field values from home page on all pages?
- ACF Taxonomy field values not select in backend
- Set ACF on order during checkout
- How to stop hiding buttons forward / backward in pagination?
- How to make a pagination with dropdown selection?
- If Statement is Ignored?
- Use WPQuery to match to specific repeater row in post
- static page pagination not working
- Query on a repeater date (acf)
- ACF values to Script with auto refresh
- ACF relationship on user profile page used for allowed access
- ACF – Can’t get custom post type by taxonomy
- Advance custom fields variable with if statement & Function
- ElseIf Statement with ACF Group field
- Trying to get pagination working on WP_Query() post grid
- Advanced Custom Forms PHP formatting for do_shortcode
- Possible to edit custom date field and display?
- Get field value and use as variable in php
- Place product field value as variable in php
- AJAX numerical pagination problem in TwentyFifteen-child theme
- ACF Gallery field images donwload
- ACF – Get ID of relationship field in flexible content
- ACF under category name in shop page [closed]
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- Get list of posts from attachment
- Pagination 404 error(I have refreshed the permalinks and tried several previous options)
- Javascript Tab Gallery with Advanced Custom Fields
- How to output values from a loop into a javascript array