# NO BUG: Dynamic data pulling incorrect info

**URL:** <https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177>\
**Category:** Bugs\
**Tags:** v1-12-1\
**Created:** [February 11, 2025, 3:06pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177 "2025-02-11T15:06:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliang](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/juliang/32/23897_2.png) [@juliang](https://forum.bricksbuilder.io/u/juliang)\
**Post date:** [February 11, 2025, 3:06pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/1 "2025-02-11T15:06:04Z")

</div>

Hey Bricks community! 😃

I have a suuuuper weird issue inside my query loops which just seems to be getting worse. I cannot seem to fix it for the life of me.

Basically, I have a card with a query loop on 2 pages. One is my home page, and one is an archive template.

**On my home page, when i use {page\_slug}, it just returns ‘home’ on all of the items** - which I can only assume comes from the home page, even though that isn’t the slug.

**On my archive template, when I use {page\_slug}, it returns memberstack-badge** - which is actually the correct slug… for ONE of the items. But it returns that slug for every single item.

**Here’s a loom video where I walk through the problem:  
 [Troubleshooting Dynamic Data Issues 🔧 | Loom](https://www.loom.com/share/cf5fd707d1084a72946561bf6ab2f5f4?from_recorder=1&focus_title=1)**

Any help would be appreciated, I’m totally lost - thank you so much!!!

---

<div class="post-metadata">

**Author:** ![juliang](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/juliang/32/23897_2.png) [@juliang](https://forum.bricksbuilder.io/u/juliang)\
**Post date:** [February 12, 2025, 9:14am UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/2 "2025-02-12T09:14:58Z")

</div>

Alright so I am almost sure this is a bug at this point - it looks like dynamic data works perfectly fine UNLESS it’s being used to set a link destination. Then it goes crazy.

Take a look at this - specifically the link destination in the bottom left corner, and the text below the button that says made-with-memberstack (this is correct)

 ![Screenshot 2025-02-12 at 10.11.15](https://forum.bricksbuilder.io/uploads/default/original/3X/a/1/a1be0f78178de71b41906837fef497138236784d.png)

Now, look at these 2 images. I’m using {post\_slug} for both, and yet this one works perfectly (not a link)

 ![Screenshot 2025-02-12 at 10.11.38](https://forum.bricksbuilder.io/uploads/default/original/3X/2/d/2d8d78db3bf8afbece6e7fde8a2f2b21956e2d55.jpeg)

And this one doesn’t work (is a link)

 ![Screenshot 2025-02-12 at 10.11.47](https://forum.bricksbuilder.io/uploads/default/original/3X/9/9/99f4ec09d07069dfa6db2e09d17b043846bbebc7.png)

---

<div class="post-metadata">

**Author:** ![Matej](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/matej/32/20184_2.png) [@Matej](https://forum.bricksbuilder.io/u/Matej)\
**Post date:** [February 12, 2025, 11:26am UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/3 "2025-02-12T11:26:59Z")

</div>

Hello @juliang,

I tried to replicate the issue, but I can’t. Check my screenshot below. First, there is a basic text, with just text, and then there is a button, with a “custom link”. And it works.

 ![CleanShot 2025-02-12 at 12.24.04@2x](https://forum.bricksbuilder.io/uploads/default/original/3X/3/7/37d6f7c193d5610e0dc78998a2bd28d4746c4d86.png)

So, what if you link the button to `{post_url}`, using “Custom URL” or using “Dynamic Data” options? It’s the same?

Can you also make sure that you don’t have nested links?

Let me know.  
Matej

---

<div class="post-metadata">

**Author:** ![juliang](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/juliang/32/23897_2.png) [@juliang](https://forum.bricksbuilder.io/u/juliang)\
**Post date:** [February 12, 2025, 1:10pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/4 "2025-02-12T13:10:35Z")

</div>

Hey Matej, thanks for getting back!!

I’ve implemented a temporary solution for now which gets the link value from the hidden text below it and sets it with JavaScript. It’s not a good solution, but it’s my interim fix until I figure this out 🤣

I’ve duplicated the page and removed my temporary fix, so you can test it at [Free Bricks Builder Components | One Click Copy | Bricks Board](https://bricksboard.com/home-duplicate/)

EDIT: Just re-read your question about post\_url and dynamic data - it is indeed the same. The constant I have found is that if it’s the URL of a link, it does not work.

---

<div class="post-metadata">

**Author:** ![Matej](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/matej/32/20184_2.png) [@Matej](https://forum.bricksbuilder.io/u/Matej)\
**Post date:** [February 12, 2025, 3:10pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/5 "2025-02-12T15:10:30Z")

</div>

Hi,

I tested, but I can’t replicate the issue. I see though, that the links in your example, are not working correctly.

Can you send temporary login credentials to your website and a link to this thread to [help@bricksbuilder.io](mailto:help@bricksbuilder.io) using the email address you used during the purchase, so we can take a look?  
If you have a staging website, I prefer a staging one 🙂

Thank you.  
Matej

---

<div class="post-metadata">

**Author:** ![juliang](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/juliang/32/23897_2.png) [@juliang](https://forum.bricksbuilder.io/u/juliang)\
**Post date:** [February 12, 2025, 3:18pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/6 "2025-02-12T15:18:50Z")

</div>

No staging website at the moment, but we don’t have any visitors yet so no worries if you do break something haha

Sending via email now!

---

<div class="post-metadata">

**Author:** ![Matej](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/matej/32/20184_2.png) [@Matej](https://forum.bricksbuilder.io/u/Matej)\
**Post date:** [February 12, 2025, 3:38pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/7 "2025-02-12T15:38:58Z")

</div>

Quick update, if anyone lands here, the issue was a custom code inside the “Custom code” element.

I’ll mark this topic as no-bug, as it was not Bricks-related.

Best regards,  
Matej

---

<div class="post-metadata">

**Author:** ![juliang](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/juliang/32/23897_2.png) [@juliang](https://forum.bricksbuilder.io/u/juliang)\
**Post date:** [February 13, 2025, 2:44pm UTC](https://forum.bricksbuilder.io/t/no-bug-dynamic-data-pulling-incorrect-info/30177/8 "2025-02-13T14:44:14Z")

</div>

Hey everyone!

This has been resolved - essentially, I had some code which was using WP\_Query inside of my query loop which was resetting the $post object.

```auto
<?php
$member_id = '{acf_member_id}';

$args = array(
    'post_type' => 'member', // Correct post type
    'posts_per_page' => 1,
    'meta_query' => array(
        array(
            'key' => 'member_id',
            'value' => $member_id,
            'compare' => '='
        )
    )
);

$query = new WP_Query($args);

if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post();
        $profile_pic_url = get_field('profile_pic_url'); // Get ACF field
        
        // Set default image if profile_pic_url is empty
        if (!$profile_pic_url) {
            $profile_pic_url = '/wp-content/uploads/2025/02/defaultprofpic.webp';
        }

        echo '<img src="' . esc_url($profile_pic_url) . '" alt="Profile Picture" class="member-profile-pic">';
    }
    wp_reset_postdata();
} else {
    echo 'No member found.';
}
?>

```

I’ve replaced it with this code which I made with ChatGPT

```auto
<?php
$member_id = get_field('member_id', get_the_ID()); // Get the correct member ID

$args = array(
    'post_type' => 'member',
    'posts_per_page' => 1,
    'meta_query' => array(
        array(
            'key' => 'member_id',
            'value' => $member_id,
            'compare' => '='
        )
    )
);

// Use get_posts() instead of WP_Query to avoid modifying the global $post
$members = get_posts($args);

if (!empty($members)) {
    $member = $members[0]; // Get the first result
    $name = get_field('name', $member->ID); // Get ACF field for this member
    echo esc_html($name);
}
?>

```

This one uses get\_posts instead of WP\_Query - so, no more problem!

Big thanks to @Matej for the amazing support. Hope this thread helps someone in the future!
