Title: Query Loop Builder: Container Link Failure
Last modified: January 19, 2023

---

# Query Loop Builder: Container Link Failure

 *  Resolved [TrekRight](https://wordpress.org/support/users/trekright/)
 * (@trekright)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/)
 * I’m using a Container inside the body of a Query Loop Builder (QLB). That container
   has a dynamic link property that links to the post permalink. I have the fetch
   count of the QLB set to the default 12.
 * The problem is that only the first 12 posts have a correct link. From post #13
   onwards, all posts have a fixed link corresponding to whatever link was used 
   when the container link was first assigned in the container block’s properties.
 * If I change the fetch count value, for example to 16, then the links will be 
   correct for the first 16 posts and then fail after that. Thus, it appears that
   something is going wrong with the way the permalink is obtained whenever additional
   fetches are done.
 * Note: neither the Dynamic Post Image or Dynamic Post Title blocks are suitable
   for my purposes here since the underlying posts aren’t using the feature image
   or post title properties.  Thus, the only way I can get a link for each post 
   is by wrapping the Query Loop Builder’s children in a container and setting the
   container’s link dynamically to the post permalink.
 * DETAILED REPRODUCE STEPS
    1. Create a new post.
    2. Add a Container block and within the container add an Advanced Text. For testing
       purposes, just leave the text at its default value.
    3. In the Container’s properties, set the Container Link to use a Dynamic Url and
       click on ‘Post Permalink’.
    4. Outside of the Container, add a Query Loop Builder block.
    5. Leave the QLB’s properties at their default settings except under Data Settings,
       where Pagination Type should be set to Infinite Scroll.
    6. Inside the QLB, replace all the existing blocks with the Container created previously.
    7. Save the post and display it on the front end.
 * EXPECTED:
 * Each post returned by the query would have a link to the underlying post (i.e.
   the permalink would be linked).
 * ACTUAL:
 * The first 12 returned posts will correctly have the permalink of the underlying
   post. All other returned posts will have the permalink of the new post in which
   you added the Query Loop Builder.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [TrekRight](https://wordpress.org/support/users/trekright/)
 * (@trekright)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16405161)
 * Have you been able to reproduce this issue yet? Please confirm – thanks!
 *  Plugin Author [wpsoul](https://wordpress.org/support/users/wpsoul/)
 * (@wpsoul)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16415132)
 * Dynamic fields will not work in Ajax requests, you must use only dynamic blocks
   there. Why do you need container link for query loop?
 *  Thread Starter [TrekRight](https://wordpress.org/support/users/trekright/)
 * (@trekright)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16415373)
 * As noted above, the contents of my query loop do not draw upon either the feature
   image or the post title. Thus, I cannot use either of the two dynamic blocks (
   Dynamic Post Image or Dynamic Post Title). Also, I want the entire ‘card’ to 
   be a link rather than just the title.  Note that within the loop all of my content
   is obtained via the Meta getter block. The problem is purely obtaining a link
   back to the underlying post.
 * I don’t think this is an issue with Ajax requests given that it works entirely
   correctly so long as the infinite scroll is not involved. For example, look at
   this page:
 * [http://trekopedia.com/lycian-way-communities-5/](http://trekopedia.com/lycian-way-communities-5/)
 * This page works, with each card correctly being a link to the underlying post.
   But it only works because I set the fetch count to 80 (there are 71 posts returned
   by this query). If the fetch count was 12, then every post returned after the
   first 12 would have an incorrect link. This sounds like something wrong with 
   the way infinite scroll works since the query itself is obviously working fine.
 * Any help you can provide with this would be appreciated.
 * Also, a question regarding containers inside a query loop: the Container Link
   property has an option to link to the post permalink. What purpose does this 
   serve if the container link shouldn’t be used inside a query loop??
 *  Plugin Author [wpsoul](https://wordpress.org/support/users/wpsoul/)
 * (@wpsoul)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16415411)
 * Infinite scroll works via Ajax. Dynamic fields can’t get ajax context like Dynamic
   blocks, so they will not work in Ajax. We can add Container link option directly
   in Query builder if you need, but you must understand that Container link means
   that everything inside each item will be link, so any inner links (categories,
   wishlist and other linkable elements will not work)
 *  Thread Starter [TrekRight](https://wordpress.org/support/users/trekright/)
 * (@trekright)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16415539)
 * Ah, I think I understand now. If it can be added easily, a Container link option
   would be very useful for my use case (where links insider the container are not
   required). Thanks!
 *  Plugin Author [wpsoul](https://wordpress.org/support/users/wpsoul/)
 * (@wpsoul)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16418786)
 * Ok, I will add to TODO list
 *  Thread Starter [TrekRight](https://wordpress.org/support/users/trekright/)
 * (@trekright)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16418794)
 * Much appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Query Loop Builder: Container Link Failure’ is closed to new replies.

 * ![](https://ps.w.org/greenshift-animation-and-page-builder-blocks/assets/icon-
   256x256.gif?rev=2773637)
 * [Greenshift - animation and page builder blocks](https://wordpress.org/plugins/greenshift-animation-and-page-builder-blocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/greenshift-animation-and-page-builder-blocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/greenshift-animation-and-page-builder-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/greenshift-animation-and-page-builder-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/greenshift-animation-and-page-builder-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/greenshift-animation-and-page-builder-blocks/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [TrekRight](https://wordpress.org/support/users/trekright/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/query-loop-builder-container-link-failure/#post-16418794)
 * Status: resolved