skip to Main Content

I’m trying to update a particular url in wordpress post_content table. I have over 5000 differents urls to update for a single same one.

So in clear I have 5000 urls that all starts with :

domain.com/params.php?....

AND always ends with :

?e=

I want all those url to be replace with a single one without parameters in so they will all send to domain.com/page.html

So is there a way to replace all the urls without having to manually doing it ?

Thanks

2

Answers


  1. Chosen as BEST ANSWER

    No it is not working. It's being written as it :

    Update `wp_posts`
    set post_content = 'domaine.com/newpage.php'
    where post_content like 'domaine.com/ads.php?city=%e='
    

    so it should take all the queries starting with domaine.com/ads.php?city= until e= but it is not and returning 0 value.

    Some knows what is wrong ?


  2. Is this what you are looking for?

    update post_content 
    set url = 'domain.com/page.html'
    where url like 'domain.com/params?%?e=0'
    

    This phrases as : replace all urls that start with 'domain.com/params?' and end with '?e=0' with 'domain.com/page.html'.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search