Support » Plugin: HTML Import 2 » [Plugin: HTML Import 2] How do I keep the existing slugs?

  • Resolved SocialBlogsite


    Taking the page slug from the post name is frivolous since it can be changed later easily, but since SEO rules, keeping the SAME slug is essential to speed-up the process of the conversion to make it live quickly.

    e.g. for a page named Title of Page, whose filename is the-page-name.html is not bad, but it’s rather costmetic. is a MUST.

    Then your rule can be only one, a generic one, redirecting not-found pages with their matching version without “.html”

    How do I get that? I can edit the plugin if needed. I just need to know what line to hack it up at.


Viewing 15 replies - 1 through 15 (of 15 total)
  • I’m not the plugin author, but I believe the HTML_Import class in html-importer.php defines a method get_post that reads the file and creates the page. This class builds up a WordPress post object in the array $my_post, without explicitly specifying the slug, and then inserts the post into the database with the lines

    if ($updatepost) {
      $my_post['ID'] = $post_id;
      wp_update_post( $my_post );
    else // insert new post
      $post_id = wp_insert_post($my_post);

    I believe these functions wp_update_post and wp_insert_post generate the slug from the title when the slug is not specified. So if you know how to compute the slug you want to use, then setting the slug to $slug should be as easy as adding

    $my_post['post_name'] = $slug;

    before the post insertion code.

    Plugin Author Stephanie Leary


    Exactly right, Mark. I’ve had several requests for this feature, and I’ll try to include it in a future version.

    Thanks Stephanie.
    Also, I’ll post another request in a different topic, considering an HTML often comes with a re-design and all the images will need a new width.

    ok…this confused me. will this help keep my old and ugly file names to be the same as they used to be?
    uglylongfilename.php vs /ugly-long-file-name/?

    From an SEO perspective am I going to hurt my site by importing the pages and renaming them to the WP standard or am I not going lose good rankings by changing from ugly file name to the WP default?



    SILLYbean any update on your statement….?

    we are still waiting for the features to keep original SLUGs.

    Plugin Author Stephanie Leary


    This feature will be in the next version of the plugin.

    Now the question is…..

    WHEN next version will be OUT….!

    if its delayed i may finish my project HARD way.

    anyway thank you for the update.

    Plugin Author Stephanie Leary


    You can download the development version and give the new option (“preserve slugs”). It should show up as version 2.3a.

    aha… its ready.

    Thank you Stephanie….

    i will do BETA testing…. and let you know.

    i cannt see the option “preserve slugs

    where is this option ?

    under Files/Content/Title/MEta/Category/Tools ?

    Plugin Author Stephanie Leary


    No, it’s under the first tab, “Files.”

    its not there.
    i reinstalled after manually deleting from phpmyadmin

    there are only 5 options
    //Directory to import
    old site URL
    Default file
    File extensions
    directories to include

    Its added in html-importer.php file but not in html-import-options.php.

    may be you are missing something

    Plugin Author Stephanie Leary


    Yes, the file for the options page didn’t get updated. Try downloading a fresh copy; it should be there now. Sorry about that!

    THANK YOU Stephanie;

    it worked. i imported 1615 pages in one shot.

    but it rename main page slug as long Title page name.htm as well as sundirectory index page name as its Title page slug.

    if you donot want to include TITLE, it will take page id number instead its original page slug.

    if same slug exists in different directories it will add slug name and -1.htm (eg: slug-1.htm, slug-2.htm)

    thats what i found out so far, i will update if anything more


    Plugin Author Stephanie Leary


    I’ve just released 2.3, which includes this feature.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: HTML Import 2] How do I keep the existing slugs?’ is closed to new replies.