最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to export posts and keep html tags in the title

programmeradmin0浏览0评论

If my post title is : Hello <b>world</b>

When exporting the posts with built-in Tools/Export, html tags are removed. I don't want that.

I have 9K posts to export with valuable styling in all titles, so even if it is not the best practice, these tags need to be kept.

In what file is the xml generated ?
Or is there some kind of hook for this ?

Thank you.

If my post title is : Hello <b>world</b>

When exporting the posts with built-in Tools/Export, html tags are removed. I don't want that.

I have 9K posts to export with valuable styling in all titles, so even if it is not the best practice, these tags need to be kept.

In what file is the xml generated ?
Or is there some kind of hook for this ?

Thank you.

Share Improve this question edited Feb 2, 2021 at 12:33 jDelforge asked Feb 2, 2021 at 11:15 jDelforgejDelforge 1051 silver badge10 bronze badges 6
  • 3 You're not supposed to be able to have HTML tags in a title, the only reason you've been able to put them in is because as an administrator/super admin you're given the unfiltered_html capability, which lets you do dangerous things. Even if your XML file contained the tags in the header on export, there's no guarantee that they won't be stripped out on import, or that the theme on the other site will even support it – Tom J Nowell Commented Feb 2, 2021 at 11:29
  • @TomJNowell Sure. But i have 9K posts to export with valuable styling in all titles. I need to find a way. Thanx for the tip! – jDelforge Commented Feb 2, 2021 at 11:56
  • 1 How are you exporting the data? are you using a plugin or you wrote some custom code? – Buttered_Toast Commented Feb 2, 2021 at 12:13
  • @jDelforge also note that any inline styling or tags can play havoc with RSS, AMP, Google, FB, twitter, OEmbed previews, etc etc OG tags can mitigate some of this but it's still an issue. You're not supposed to have inline styling in titles. Are all your tags and styles the same as what's in your question? Were you using this to try and create sub-titles? – Tom J Nowell Commented Feb 2, 2021 at 12:18
  • @Buttered_Toast Post edited : I'm exporting with built-in Tools/Export. It is simple and complete for my needs... I just have a problem with the titles. – jDelforge Commented Feb 2, 2021 at 12:35
 |  Show 1 more comment

1 Answer 1

Reset to default -1

In the file wp-admin/includes/export.php

Within the post loop, line 545, simply replace

$title = apply_filters( 'the_title_rss', $post->post_title );

with

$title = $post->post_title;
发布评论

评论列表(0)

  1. 暂无评论