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.
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)
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.
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
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.
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 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
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.
<?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
<?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!