Get Permalink By Page Name Or Slug

We used to write custom functions to return these values until we discovered you can pass get_permalink a function that will return the ID. Examples.. Get Permalink By Page Name [php] <a href="<?php echo get_permalink( get_page_by_path( 'Events' ) ) ?>">Events</a> [/php] Get Permalink By Page Slug [php] <a href="<?php echo get_permalink( get_page_by_path( 'events' ) ) ?>">Events</a> [/php] Note On Hierarchical Pages and The Slug If you have a page hierarchy you will have to pass the full slug including the parent to [ Read More ]

Want to work with us?

Do you need help with WordPress? Get in touch right away. We can't wait to work with you. Call us at (515) 966-4848 or email Andy.

Recent Posts

Follow Along