最近的帖子循环 return 错误的固定链接

Recent posts loop return wrong permalink

我有一个在 wordpress 中显示最近 posts 的循环:

        <ul class="homepage-section homepage-era-jazzu fusion-clearfix">
        <?php
            $args = array( 'numberposts' => '4', 'post_type' => 'era-jazzu', 'post_status' => array('publish', 'future') );
            $recent_posts = wp_get_recent_posts( $args );
            foreach( $recent_posts as $recent ){
                echo '<li><a href="' . get_post_permalink($recent["ID"]) . '">' . get_the_post_thumbnail($recent["ID"], '260-160') . $recent["post_title"].'</a> </li> ';
            }
            wp_reset_query();
        ?>
        </ul>

它有效,但不是我想要的方式。我的问题如下 - 有时最近的 post 之一是 'scheduled' post。这就是为什么它的永久链接是丑陋的:http://yourdomainurl.com/?post_type=jazz&p=10603

如何让它与像您的域 url 这样的永久链接一起工作。com/nice-address

?从管理员的角度来看,一切都很好(所以在仪表板中我看到了很好的永久链接;唯一的问题是我的循环代码)。

谢谢!

只需在 get_permalink($recent["ID"]) 上更改 get_post_permalink($recent["ID"]),一切都会正常进行。