• Hi, I’ve found this unsolved thread and I have a similar problem:

    I need to output the permalink ID to a variable and trying the get_permalink function

    $permalinkid = get_permalink($post->ID);

    Here returns the domain URL + the permalink ID and not only the permalink ID (?p=…)

    Why?

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Because a permalink is a fully formed url. Why not just use $post->ID id you only want the id?

    Thread Starter mm88

    (@mm88)

    Ok, many thanks, I was a bit confused about the attributes of get_permalink.

    And passing the post’ ID to a page, in which way could I modify the loop query to reorder the posts showing the passed variable as first?

    thanks

    I think you’d basically need to run 2 Loops – the first for your specific post/page id and then the second for everything but that post.

    Have a look at http://codex.wordpress.org/The_Loop#Multiple_Loops

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Why get_permalink($id) is not working?’ is closed to new replies.