Support » Fixing WordPress » setting the permalink using wp insert post

  • Hello,

    I’m attempting to migrate thousands of html/php pages into several wordpress installations so the wp insert post help page has been indispensable. But there seems to be one critical parameter missing from the import array: ‘set permalink’.

    In my case, I want the permalink set to the file name (e.g. 20100101foster.php) and I’ll also want to use another variable to insert the post title (i.e. go to the “title” div and insert the title).

    First, if it is possible to set the permalink on import, how do I do so?

    Second, when setting the permalink, if my original URL had a .php or .html extension, will the URL work? If not, how do I make it work.

    Third, I’d like to automate the process and use variables to pull in the permalink and title (and possibly tags); where do I start in creating this script?

    Any help is much appreciated. Many thanks,


Viewing 1 replies (of 1 total)
  • s_ha_dum


    1. I believe that the ‘post_name’ field in the ‘wp_posts’ table is the permalink ‘slug’.
    2. You’ll probably need to strip the extension of convert it to something like ‘-php’.
    3. Yikes!. A function running in a theme’s functions.php should give you easy access to all of WP’s built in functions, which will greatly ease the insertion process. It seems to me that the hardest part will be parsing those html and php files to sort out the titles, categories, author, content, images, and such.
Viewing 1 replies (of 1 total)
  • The topic ‘setting the permalink using wp insert post’ is closed to new replies.