Title: get_permalink returns default link
Last modified: August 20, 2016

---

# get_permalink returns default link

 *  [Iperdesign_IT](https://wordpress.org/support/users/iperdesign_it/)
 * (@iperdesign_it)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/get_permalink-returns-default-link/)
 * Hi guys, I hope you can help me.
 * So i’m using /%postname%/ as permalink structure, and my htaccess is this:
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /develop/sekai/
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /develop/sekai/index.php [L]
       </IfModule>
   
       # END WordPress
       ```
   
 * Hovewer, get_permalink returns me the default permalink structure (?page_id=x),
   while menus are fine with their links. What should i do? Thanks for all!! 😀

Viewing 1 replies (of 1 total)

 *  [klahla](https://wordpress.org/support/users/klahla/)
 * (@klahla)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/get_permalink-returns-default-link/#post-3179487)
 * I was working on front-end submission form and encounted a similar issue. Then
   understood how and why it works this way.
 * Code looked something like this:
 *     ```
       if ( ... ) { $pstatus = "post"; }
              else { $pstatus = "draft"; }
   
       $new_post = array( ...
         'post_status' => $pstatus );
       $post_id = wp_insert_post($new_post);
       $link = get_permalink($post_id);
       echo $link;
       ```
   
 * Here is the deal.
 * When you submit post as a DRAFT,
    admin/editor can change the permalink before
   it is ever posted. The post slug ($post->post_name;) simply does not exist yet.
   So returning “?page_id=” is the only option wordpress has.
 * If you submit post as a POST,
    then everything works perfectly as expected.
 * Hope it helped.

Viewing 1 replies (of 1 total)

The topic ‘get_permalink returns default link’ is closed to new replies.

## Tags

 * [get_permalink](https://wordpress.org/support/topic-tag/get_permalink/)
 * [postname](https://wordpress.org/support/topic-tag/postname/)
 * [wrong permalink](https://wordpress.org/support/topic-tag/wrong-permalink/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [klahla](https://wordpress.org/support/users/klahla/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/get_permalink-returns-default-link/#post-3179487)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
