Grab wordpress post title by SQL

Asked

Viewed 36 times

1

Well, I need something like this:

$titulo = get_the_title( $post_id );
update wp_posts set post_content =
replace(post_content,'>Episódio','>$titulo Episódio');

I know you’re completely wrong, but maybe it’ll help you understand better. I need to add the title of the post in a row of the same by SQL command (in all posts will be done this).

  • Utilize $wpdb->update() or $wpdb->query() for this. In this way the change will be applied at once. I think this is, if it is not, it would be nice to exemplify.

  • Actually, this function I put up already updates everything at once. The real problem is that I want to put the name of the post in the middle of this substitution, but I don’t know how to get the title value.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.