钩子文档

the_content_export

💡 云策文档标注

概述

the_content_export 是一个 WordPress 过滤器钩子,用于在生成 WXR 导出文件时过滤文章内容。它允许开发者在导出过程中修改或处理文章内容。

关键要点

  • 过滤器钩子:the_content_export,用于过滤 WXR 导出中的文章内容。
  • 参数:接受一个字符串参数 $post_content,表示当前文章的内容。
  • 使用场景:在 export_wp() 函数中调用,用于生成 WXR 导出文件。
  • 版本历史:自 WordPress 2.5.0 版本引入。

代码示例

$content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );

注意事项

该钩子主要用于导出功能,开发者可以添加自定义过滤器来修改导出内容,例如添加额外数据或格式化处理。


📄 原文内容

Filters the post content used for WXR exports.

Parameters

$post_contentstring
Content of the current post.

Source

$content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );

Changelog

Version Description
2.5.0 Introduced.