link to internal page wordpress link to internal page wordpress wordpress wordpress

link to internal page wordpress


You could use

<a href="<?php echo get_page_link( get_page_by_title( PAGE_NAME )->ID ); ?>">Link Title</a>

Where PAGE_NAME is the page title you have set in the dashboard.

get_page_by_title() returns an object and we use get_page_by_title( PAGE_NAME )->ID to return the page ID of that page. Note that it is more consistent to rely on the page title (which you set yourself) against page ID (which is set by wordpress).

get_page_link() retrieves the permalink of that page ID you passed as parameter.


You can simply link to the page in the HTML body of the home page. For example:

<a href="/index.php/your-page">your page</a>

or

<a href="index.php?page_id=###">your page</a>

Where ###, put the post ID.

More examples

Edit:

If you are editing a template, and wish to obtain the permalink of the post using its ID, use get_permalink($id)

More information about this function

Edit 2:

Based on your comments, you have to switch the permalink format. In WP Admin, find Permalink Settings, and set them to /%postname%/

Read more about these settings here