我正在连接到“在编辑器之后编辑\\u form\\u”
add_action(\'edit_form_after_editor\', \'make_the_button_to_generate_a_report_number\');
function make_the_button_to_generate_a_report_number($post) {
检查我是否正在处理“出版物”的自定义帖子类型if ($post->post_type != \'publications\') return;
创建一些参数,然后在WP\\u查询中运行这些参数$new_query = new WP_Query($report_number_args);
使用这些数据做一些事情然后我想重置
$post
回到过去,所以我跑了wp_reset_postdata();
但是$post
停留在我从新WP\\U查询()收到的最后一个项目上<我做错了什么?在处理自定义帖子类型时,是否有特殊的方法重置postdataUpdate:在函数的开头和结尾,我有:
echo("<h4>the title = </h4>");
echo(the_title());
开始时,标题是我单击要编辑的自定义帖子类型的标题,如果我正在创建新帖子,则为空。最后,标题总是我查询的最后一篇文章。