The MU forums have moved to WordPress.org

Pages and Permalink (6 posts)

  1. pgianf
    Member
    Posted 17 years ago #

    Hi
    I'm writing a little piece of code to create a number of pages under a blog. I'm using wp_insert_page which I call with these arguments:
    $input = array(
    'post_title' => "test",
    'post_content' => "Yes Ive got it",

    'post_status' => "published",
    'post_category' => 1 ,
    'post_type' => 'page'
    );

    the problem i have tha it returns a wrong permalink like this:
    http://myhost/myblog/1969/10/11/
    I dont know where it get this year, anyway this link doens work. The link that works has this structure http://myhost/myblog/?page_id=2
    A strange thing is that if i create a page using the admin consolle the permalink is http://myhost/myblog/page/2/
    It is nicer but I would like to control the generated permalink in oder to have a permalink structure like this
    http://myhost/myblog/name/surname/ of page creator.
    How can i get this result?

    thanks
    Paolo

  2. dsader
    Member
    Posted 17 years ago #

    "post_name" => $surname,?
    "post_autor" => $user_ID,?

  3. SteveAtty
    Member
    Posted 17 years ago #

    wp_insert_page?

  4. johndeery
    Member
    Posted 17 years ago #

    Did you check under Options -> Permalinks? You can change how they're displayed in there and set a custom type there.

  5. lunabyte
    Member
    Posted 17 years ago #

    Did you pass a date to the function?

  6. pgianf
    Member
    Posted 17 years ago #

    No i dont pass any date.
    wp_insert_page is a copy of wp_insert_post where i've changed $wpdb->posts with the table name of my blog "wp_14". I didnt how to instruct wp_insert_post to use my table name.
    Ihave seen that i can customize permalink structure from the consolle it was set to /paolo/2007/10/30/sample-post/ so probably without passing any date it starrted with 1969.
    I'll try to use /pages/%postname%/ structure, at the end i've undertood it is sufficient to change the permalink row in my wp_14_options table. I hope it will work
    thanks
    Paolo

About this Topic