Forums

How to move pages to articles ? (5 posts)

  1. jfoulquier
    Member
    Posted 2 months ago #

    Hello,

    I have a huge amount of pages on my wordpress websites that I want to move to the "Articles" section. I'm talking about ~1500 pages that have to be moved.

    How can I do ?

  2. tomontoast
    Member
    Posted 2 months ago #

    You can write a database query which will do this for you. With your webhosting do you have access to an application called phpMyAdmin?
    Otherwise you need to run a PHP file which will modify the database like follows:
    UPDATE wordpress.wp_posts SET post_type = 'page' WHERE wp_posts.ID =1 LIMIT 1 ;

  3. jfoulquier
    Member
    Posted 2 months ago #

    Yes I have access to phpMyAdmin.

    Thank you for your reply. But I assume you meant :
    UPDATE wordpress.wp_posts SET post_type = 'article' WHERE wp_posts.post_type = 'page';

    I'm gonna try your suggestion. But are you sure it will be enough to work ? I mean, all my articles have rewrited url like http://www.mydomain.com/2009/09/keyword1-keyword2-id/
    How can my WordPress know the url of the articles that just have been moved from pages to articles ?

    Thx.

    ++

  4. tomontoast
    Member
    Posted 2 months ago #

    Articles are known as posts in wordpress speak so it should actually be
    UPDATE wordpress.wp_posts SET post_type = 'posts' WHERE post_type = 'page';

    You have a point about the urls, do you have caching turned on? If not wordpress should adjust automatically, the urls aren't stored in the database directly. Otherwise you may have to refresh the cache and flush the rewrite rules.

  5. jfoulquier
    Member
    Posted 2 months ago #

    Thanks, it works well, just as expected.

    ++

    (sorry for the late reply)

Reply

You must log in to post.

About this Topic