Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

leisegang on "Prepend code to the_content via MySQL"

$
0
0

I have a custom field called: _format_video_embed

i want the value of this field that is a youtube link added to the start of the posts that i have. There are over 1400 posts that does not have the video link in the post_content but in the post_meta field called _format_video_embed

Is there a way to add this via MySQL?

Some update command that could work?

SELECT wposts.ID, wposts.post_title, wposts.post_content,wposts.post_type, wpostmeta.*
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key LIKE '_format_video_embed'
    AND wposts.post_type = 'post'
    ORDER BY wposts.ID DESC

That selects all the fields i need. Now i need to insert the meta value into the post_content. as the first line.

Can anyone help me with that?

Or some code to add to my functions.php that copies that field?


Viewing all articles
Browse latest Browse all 8245

Trending Articles