Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何让Wordpress以降价格式保存评论?_Php_Wordpress_Comments_Markdown - Fatal编程技术网

Php 如何让Wordpress以降价格式保存评论?

Php 如何让Wordpress以降价格式保存评论?,php,wordpress,comments,markdown,Php,Wordpress,Comments,Markdown,我喜欢标记,我的帖子和评论中都有Wordpress解析标记 但是,我注意到Wordpress保存了以html格式呈现的注释。这使得返回并编辑评论更加困难。如何让wordpress以降价格式保存评论 我找不到它的插件。也许有一个简单的php黑客 编辑: 也许这不是wordpress的固有功能。如果没有markdown插件,注释通常不会与任何标记一起保存。可能是wordpress和bbpress“功能”/“意外”的降价 交叉邮寄到。BAinternet有一些很好的想法来保存注释的标记,比如在save

我喜欢标记,我的帖子和评论中都有Wordpress解析标记

但是,我注意到Wordpress保存了以html格式呈现的注释。这使得返回并编辑评论更加困难。如何让wordpress以降价格式保存评论

我找不到它的插件。也许有一个简单的php黑客

编辑: 也许这不是wordpress的固有功能。如果没有markdown插件,注释通常不会与任何标记一起保存。可能是wordpress和bbpress“功能”/“意外”的降价

交叉邮寄到。BAinternet有一些很好的想法来保存注释的标记,比如在save插件上的标记,但是还没有有效的解决方案

部分破解 可以帮忙吗?可能与主题有关。列表有时仍会保存或渲染

在wordpress和bbpress/markdown.php的
wp content/plugins/markdown中,注释掉
pre_comment_content
markdown过滤器

 if (MARKDOWN_WP_COMMENTS) {
    remove_filter('comment_text', 'wpautop', 30);
    remove_filter('comment_text', 'make_clickable');
    #HACK don't save comments rendered in HTML
    #add_filter('pre_comment_content', 'Markdown', 6);
    add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
    add_filter('pre_comment_content', 'mdwp_show_tags', 12);
    add_filter('get_comment_text',    'Markdown', 6);
    add_filter('get_comment_excerpt', 'Markdown', 6);
    add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);

我想你可以使用-hook来处理数据。

问得好。由于此功能在Wordpress插件中不可用,您至少需要进行一些黑客操作以阻止它以HTML格式保存,您已经完成了这项操作

现在,您需要知道何时显示注释,以处理标记为HTML的过程。因此,让我们使用
注释\u文本
挂钩:

<?php add_filter('comment_text', 'Markdown'); ?>

好问题,虽然我不认为会有一个简单的PHP破解。嗯,我嗅到了一个插件的机会!另外,在我们的姐妹wordpress站点中,您可能会更幸运。保存时,我不需要操纵数据,我需要保留原始的降价数据。我不认为“保存”这个评论有用。
function set_save_format($format) {

  if ($format == 'markdown') {
    // Ok we need to change the format of any comments output to html:
    add_filter('comment_text', 'Markdown');
  }

}