首先,你没有$post->ID
, 你有$query->$post->ID
在您的WP\\U查询结果中:
<?php
$my_post_meta = get_post_meta(
$query->$post->ID, // note this
\'ozellikler_text\',
true
);
echo do_shortcode( \'[svg-flag flag="\' . $my_post_meta . \'"]\' );
其次,正如错误文本中所写的那样,您不能重新声明已经声明的内置函数。只需使用它:
<?php
$my_post_meta = get_post_meta(
get_the_ID(), // use the built-in function
\'ozellikler_text\',
true
);
echo do_shortcode( \'[svg-flag flag="\' . $my_post_meta . \'"]\' );