Forums

Have Post ID need link to post (3 posts)

  1. trodoel
    Member
    Posted 3 years ago #

    My plugin gets a post id out of the database and needs to display the link on the plugin option page. How do I make the link? I have blogs installed on the root of the domain and on sup directories but want to avoid having an option to ask for the location of the blog posts.

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Could use $link = get_permalink( $post->ID ); then use $link in your <a href.

  3. trodoel
    Member
    Posted 3 years ago #

    This code needs to work from inside a plugin's options page. I tried to use ABSPATH, but thats the directory on the server, not a URL I can use to link.

    My plugin collects some stats about posts. On the options page for the plugin I want to list a few posts. I can get the Post ID out of the database, but how to I get the URL for those posts?

    On one blog it would be easy as I know the URL, but I want to use the plugin on different blogs with different blogs.

Topic Closed

This topic has been closed to new replies.

About this Topic