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

SQL Query : how copy all tags of post into their post content in wordpress by sql query

programmeradmin0浏览0评论

I want to copy/move all tags of a post into posts content, as text form not in a link form.

For example:

A post has:

  • a title in title field,
  • some content in content field (like: a boy has good nature),
  • three tags (like: x1,x2,x3).

Can we copy all tags of that post in their content field, like:

A post has:

  • a title in title field,
  • some content in content field (like: a boy has good nature x1 x2 x3),
  • three tags (like: x1,x2,x3).

as in text, not in link form.

I want to copy/move all tags of a post into posts content, as text form not in a link form.

For example:

A post has:

  • a title in title field,
  • some content in content field (like: a boy has good nature),
  • three tags (like: x1,x2,x3).

Can we copy all tags of that post in their content field, like:

A post has:

  • a title in title field,
  • some content in content field (like: a boy has good nature x1 x2 x3),
  • three tags (like: x1,x2,x3).

as in text, not in link form.

Share Improve this question edited May 10, 2019 at 9:40 Neeraj Bill asked May 9, 2019 at 10:19 Neeraj BillNeeraj Bill 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can simply preprocess the content by adding a filter to the_content like that:

function wpse_337486( $content ) {

    if ( is_single() ) {

        // Get the current post.
        global $post;

        // Get all post tags. Get only their names.
        $tags = wp_get_post_tags($post->ID, ['fields' => 'names']);

        // Append post tags to content.
        $content = $content . ' ' . implode(' ', $tags);
    }

    return $content;
}

add_filter( 'the_content', 'wpse_337486' );
发布评论

评论列表(0)

  1. 暂无评论