Getting started with WordPressget_bloginfo()Enqueuing scriptsMaking network requests with HTTP APIEnqueuing Styleshome_url()Custom Post Typestemplate_includeThe Loop (main WordPress loop)AJAXThe $wpdb ObjectActions and Filterswp_get_current_user()Add/remove contact info for users with user_contactmethods filter hookCreating a custom templateCustomizer Hello WorldCustomizer Basics (Add Panel, Section, Setting, Control)The Admin Bar (aka "The Toolbar")Querying postsAlternating main loop (pre_get_posts filter)ShortcodeCreate a Post Programmaticallyget_template_part()Taxonomiesget_template_part()ShortcodesPost FormatsCustom exerpts with excerpt_length and excerpt_morePlugin developmentSecurity in WordPress - EscapingTemplate hierarchyRemove Version from Wordpress and StylesheetsChild Theme Basicsadd_action()get_template_part()Shortcode with attributeSidebarsSecurity in WordPress - SanitizationinitCreate Template for Custom Post TypeFunction: add_action()Add ShortcodeHow Can I integrate Markdown editor with Advance Custom Field's repeater Add-on.Installation and Configurationwp_get_current_user()WP-CronSecure your installationOptions APIFunction : wp_trim_words()WP_Query() LoopUpdate WordPress ManuallyThemesWP-CLIDebuggingadd_menu_page()add_submenu_page()get_option()get_permalink()get_the_category()the_title()get_the_title()add_editor_style()add_theme_support()WordPress Plugin creationRun WordPress local with XAMPPAdmin Dashboard WidgetsSite MigrationMeta BoxRemove Auto Line Breaks From Content and Excerptget_home_path()Wordpress theme and child-theme developmentREST API

get_permalink()

Other topics

Remarks:

For the parameter $leavename, it is false by default.

Simple use of get_parmalink

Code

echo get_permalink();

Output

The link of the current page, for example: http://website.com/category/name-of-post/

Specifying the post to get the link

Code

echo get_permalink( 44 );

Output

The link of the post id:44, for example: http://website.com/category/name-of-post/

Get the link without the post's name

Code

echo get_permalink( 44 , false );

Output

The link of the post id:44 without the name of the post, for example: http://website.com/category/%postname%/

Syntax:

  • get_permalink( $post, $leavename )

Parameters:

ParameterDetails
$post(int) (optional) Post ID or post object. Default is the the current post's id.
$leavename(bool) (optional) Whether to keep post name or page name.

Contributors

Topic Id: 9209

Example Ids: 28582,28583,28584

This site is not affiliated with any of the contributors.