Wordpress shortcode prints wrong value from custom post type
-
Hey guys, I run into a problem with developing a new project of mine, more specifically with a shortcode of mine. About the website setup: - I use wordpress - I use Elementors template option to print out a template on on all pages belonging to the taxonomy "Marken". - Custom post types are created with CPT UI and custom fields with ACF I got the following shortcode, to print out the specific brand on the site iteself:
add_shortcode( 'MODELL', 'modell_shortcode' );
function modell_shortcode() {
$terms = get_the_terms( array(
'post_type' => 'fahrzeuge',
'taxonomy' => 'marken',
'hide_empty' => false,
) );
return ucwords($terms[1]->slug);
}The code works fine put prints out the wrong brand. As you can see here Tesla – moinmobility.de[^] "Tesla" should be written in the text above but "Audi" is shown. The same issue applies for the other shortcodes there should be written "0 €" instead of "345 €" etc. Is this a problem with my shortcode? With Elementor? And how to fix this? Searched a lot on Google, Blogposts and Forums but couldn't find a helpful answear. Hope someone here can help me :)