spot_img
HomeWordPress教程wordpress建站公司 在短代码中使用 wp_editor

wordpress建站公司 在短代码中使用 wp_editor

spot_img

JasperAI 10000字免费额度试用

我正在构建一个用于前端提交的插件。 我正在使用短代码 API 来显示内容提交的表单,但我遇到了麻烦。 问题是,wp_editor echoe 的数据,shortcode 应该返回数据。 当我像这样集成 wp_editor 时:

$final_form .= wp_editor();

表单确实呈现,但不在地方,而是在帖子内容之上,其中包含 shotcode。 你知道如何在短代码 API 中使用 wp_editor 吗? 我不想手动调用 TinyMCE 等。

谢谢。

WordPress divi主题

如果一个函数 echos 数据,你可以使用 php 输出缓冲来捕获 echo编辑输出并返回它

// Turn on the output buffer
ob_start();

// Echo the editor to the buffer
wp_editor();

// Store the contents of the buffer in a variable
$editor_contents = ob_get_clean();

// Return the content you want to the calling function
return $editor_contents;

5分钟生成10篇英文软文article forge软件试用
siteground guangda
WordPress花园官方账号
WordPress花园隶致力于为广大跨境电商和独立站爱好者提供优质的WordPress教程、Woocommerce教程、Facebook、Twitter、tiktok、Instagram教程和谷歌SEO教程等资料和对应的建站推广服务。关注‘哟派出海’公众号了解最新资讯。粉丝福利:Shopline免费独立站建设14天优惠 商务合作: [email protected]
RELATED ARTICLES