WordPress filter hook · part of WordPress core

the_permalink

A WordPress core filter that 70 plugins also fire themselves, running on 4.2M+ sites between them.

“This filter is documented in wp-includes/link-template.php”

How to use the_permalink

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'the_permalink', function( $permalink ) {
	// Change $permalink here.
	return $permalink;
}, 10, 1 );

Argument names come from WP Bootstrap Carousel's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

70 plugins that fire the_permalink

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Jetpack icon Jetpack3+ million installs apply_filters( 'the_permalink', get_permalink() ) modules/carousel/jetpack-carousel.php:500
  2. GTM4WP icon GTM4WP700,000+ installs apply_filters( 'the_permalink', $product instanceof \WC_Product ? $product->get_permalink() : '', 0 ) src/Modules/WooCommerce/ListTracking.php:198
  3. The Plus Addons for Elementor icon The Plus Addons for Elementor100,000+ installs apply_filters( 'the_permalink', get_permalink() ) modules/widgets/tp_post_comment.php:1482
  4. Customer Reviews for WooCommerce icon Customer Reviews for WooCommerce80,000+ installs apply_filters( 'the_permalink', get_the_permalink(), $cr_item_id ) templates/cr-review-form.php:66
  5. Display Posts icon Display Posts70,000+ installs apply_filters( 'the_permalink', get_permalink() ) display-posts-shortcode.php:497
  6. Brizy icon Brizy60,000+ installs apply_filters( 'the_permalink', get_permalink($p_id), $this->getWpPost() ) editor/post.php:224
  7. Master Addons for Elementor icon Master Addons for Elementor30,000+ installs apply_filters( 'the_permalink', get_permalink($post_id), $post_id ) addons/content/ma-comments/ma-comments.php:2280
  8. Directorist: AI-Powered Business Directory, Listings & Classified Ads icon Directorist: AI-Powered Business Directory, Listings & Classified Ads20,000+ installs apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) includes/review/class-comment-form-renderer.php:320
  9. Animation Addons for Elementor icon Animation Addons for Elementor10,000+ installs apply_filters( 'the_permalink', get_permalink( $aaeaddon_post_id ) ) templates/comments.php:203
  10. Business Directory Plugin icon Business Directory Plugin10,000+ installs apply_filters( 'the_permalink', get_permalink() ) includes/abstracts/class-view.php:136
  11. Catch Gallery icon Catch Gallery10,000+ installs apply_filters( 'the_permalink', get_permalink() ) inc/jetpack-carousel.php:135
  12. Related Posts by Taxonomy icon Related Posts by Taxonomy10,000+ installs apply_filters( 'the_permalink', get_permalink( $post ), $post ) includes/template-tags.php:227
  13. Nexter Blocks icon Nexter Blocks9,000+ installs apply_filters( 'the_permalink', get_permalink() ) classes/blocks/tp-post-comment/index.php:102
  14. FeedWordPress icon FeedWordPress8,000+ installs apply_filters( 'the_permalink', get_local_permalink( $id ) ) template-functions.php:165
  15. Gmedia Photo Gallery icon Gmedia Photo Gallery7,000+ installs apply_filters( 'the_permalink', get_permalink( $postid ) ) template/comments.php:44
  16. ProfileGrid icon ProfileGrid5,000+ installs apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) public/class-profile-magic-public.php:6725
  17. LocalWeb All In One icon LocalWeb All In One5,000+ installs apply_filters( 'the_permalink', get_permalink(), 0 ) public/partials/lw-all-in-one-public-woocommerce-gtm.php:616
  18. Gallery Carousel Without JetPack icon Gallery Carousel Without JetPack4,000+ installs apply_filters( 'the_permalink', get_permalink() ) carousel/jetpack-carousel.php:146
  19. Hierarchical HTML Sitemap icon Hierarchical HTML Sitemap4,000+ installs apply_filters( 'the_permalink', get_permalink( $page ), $page ) hierarchical-sitemap.php:262
  20. WPMobile.App icon WPMobile.App3,000+ installs apply_filters( 'the_permalink', get_permalink() ) themes/wpappninja/comments.php:100
  21. Post Content Shortcodes icon Post Content Shortcodes2,000+ installs apply_filters( 'the_permalink', get_permalink( $p->ID ) ) classes/class-post-content-shortcodes.php:854
  22. RS Template Builder For Elementor icon RS Template Builder For Elementor2,000+ installs apply_filters( 'the_permalink', get_permalink() ) includes/elementor/widgets/class-post-excerpt.php:376
  23. XML Sitemaps icon XML Sitemaps1,000+ installs apply_filters( 'the_permalink', get_permalink( $this->blog_page_id ) ) xml-sitemaps-utils.php:188
  24. Reviews Plus icon Reviews Plus1,000+ installs apply_filters( 'the_permalink', get_permalink( get_the_ID() ) ) includes/includes.php:55
  25. MDTF icon MDTF900+ installs apply_filters( 'the_permalink', get_permalink($wp_query->queried_object->ID) ) views/shortcode/do_mdf_search_form.php:897
  26. Custom CSS icon Custom CSS900+ installs apply_filters( 'the_permalink', $this->_getWPLayer()->get_permalink( $post_id ) ) fresh-framework/framework/themes/functions/class.ffCommentsFormPrinter.php:165
  27. xili-language icon xili-language600+ installs apply_filters( 'the_permalink', get_permalink( $post->ID ) ) xili-language.php:2734
  28. Webcomic icon Webcomic600+ installs apply_filters( 'the_permalink', get_permalink( $args['post_parent']->ID ) ) lib/transcribe/globals.php:222
  29. Essential Classy Addons for Elementor icon Essential Classy Addons for Elementor400+ installs apply_filters( 'the_permalink', get_permalink() ) element/widgets/ecafe-post-comment.php:1755
  30. Robots & Sitemap icon Robots & Sitemap400+ installs apply_filters( 'the_permalink', $this->url, $this->post ) core/db/post/class-sitemap-post-item.php:133
  31. Mihdan: Ajax Edit Comments icon Mihdan: Ajax Edit Comments300+ installs apply_filters( 'the_permalink', get_permalink( $oldPostID ) ) lib/class.ajax.php:704
  32. WP Bootstrap Carousel icon WP Bootstrap Carousel100+ installs apply_filters( 'the_permalink', get_permalink( $post_id ) ) inc/wp-bootstrap-carousel-dps.php:248
  33. Funtionalities for Alpus theme icon Funtionalities for Alpus theme100+ installs apply_filters( 'the_permalink', get_permalink() ) framework/addons/share/class-alpus-share.php:148
  34. Schema Breadcrumbs icon Schema Breadcrumbs100+ installs apply_filters( 'the_permalink', $link ) schema-breadcrumbs.php:889
  35. Bookmark Me icon Bookmark Me90+ installs apply_filters( 'the_permalink', get_permalink() ) sem-bookmark-me.php:242
  36. WP Custom Author Image icon WP Custom Author Image90+ installs apply_filters( 'the_permalink', get_permalink($post_id) ) wp-custom-author-image.php:324
  37. Simple Hierarchical Sitemap icon Simple Hierarchical Sitemap80+ installs apply_filters( 'the_permalink', get_permalink($id) ) inc/class.shortcode.php:27
  38. Super Related Posts icon Super Related Posts50+ installs apply_filters( 'the_permalink', get_permalink($result->ID) ) includes/output_tags.php:35
  39. ShareMe icon ShareMe40+ installs apply_filters( 'the_permalink', get_permalink() ) class.shareMe.php:189
  40. Custom Sidebars Manager icon Custom Sidebars Manager20+ installs apply_filters( 'the_permalink', $this->_getWPLayer()->get_permalink( $post_id ) ) fresh-framework/framework/themes/functions/class.ffCommentsFormPrinter.php:165
  41. Posts Per Page Customizer icon Posts Per Page Customizer20+ installs apply_filters( 'the_permalink', $this->_getWPLayer()->get_permalink( $post_id ) ) fresh-framework/framework/themes/functions/class.ffCommentsFormPrinter.php:165
  42. Comments Everywhere icon Comments Everywhere10+ installs apply_filters( 'the_permalink', get_permalink( $post_id ) ) files/comment-template.php:30
  43. Social Bookmark icon Social Bookmark10+ installs apply_filters( 'the_permalink', get_permalink() ) social-bookmark-dyc.php:237
  44. SB Comment icon SB Comment10+ installs apply_filters( 'the_permalink', get_permalink() ) inc/sb-plugin-functions.php:35
  45. WP Forum icon WP Forum10+ installs apply_filters( 'the_permalink', get_permalink() ) view/shortcode/wp-forum-inner.php:29
  46. GDPress icon GDPress10+ installs apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) gp-includes/class/GDP_Request.class.php:85
  47. Category class icon Category class10+ installs apply_filters( 'the_permalink', get_permalink($this->ID) ) inc/squelette.class.php:21
  48. Give Me Answer Lite icon Give Me Answer Lite10+ installs apply_filters( 'the_permalink', get_permalink( $post_id ) ) includes/class-template.php:288
  49. FV Community News icon FV Community News10+ installs apply_filters( 'the_permalink', get_permalink(home_url('/')) ) fvcn-theme/fvcn/form-post.php:63
  50. NutritionWP icon NutritionWP10+ installs apply_filters( 'the_permalink', $this->get_permalink() ) includes/class-nwp-post.php:141
  51. News List ShortCode icon News List ShortCode10+ installs apply_filters( 'the_permalink', get_permalink() ) news-list-shortcode.php:162
  52. RP News Ticker icon RP News Ticker10+ installs apply_filters( 'the_permalink', get_permalink() ) rp-news-ticker-front.php:84
  53. Nuconomy Insights icon Nuconomy Insights10+ installs apply_filters( 'the_permalink', get_permalink($p->ID) ) nuconomy.php:1096
  54. Plugin Name: GMO Share Connection icon Plugin Name: GMO Share Connection10+ installs apply_filters( 'the_permalink', get_permalink() ) gmo-share-connection.php:470
  55. LH Posse icon LH Posse10+ installs apply_filters( 'the_permalink', get_permalink() ) lh-posse.php:67
  56. WP Horizontal Slider icon WP Horizontal Slider10+ installs apply_filters( 'the_permalink', get_permalink() ) wp-horizontal-slider.php:53
  57. Social Hub icon Social Hub10+ installs apply_filters( 'the_permalink', get_permalink() ) class-share-buttons.php:104
  58. Image Annotations icon Image Annotations10+ installs apply_filters( 'the_permalink', get_permalink(get_the_ID()) ) image-annotations.php:420
  59. ENL Newsletter icon ENL Newsletter10+ installs apply_filters( 'the_permalink', get_permalink() ) include/tools.php:36
  60. Plugin Name: Highlight Post Widget icon Plugin Name: Highlight Post Widget10+ installs apply_filters( 'the_permalink', get_permalink() ) highlight-post.php:51
  61. Business Listing Plugin icon Business Listing PluginFewer than 10 installs apply_filters( 'the_permalink', get_permalink() ) includes/bizlisting-shortcode.php:416
  62. CommentAura icon CommentAuraFewer than 10 installs apply_filters( 'the_permalink', get_permalink((int) $data['post_id']), (int) $data['post_id'] ) views/thread/comment-form-shell.php:79
  63. WP RESTful Users Plugin icon WP RESTful Users PluginFewer than 10 installs apply_filters( 'the_permalink', get_permalink( $post_id ) ) wp-restful-users.php:163
  64. Zhu Posts Icon Carousel for WordPress icon Zhu Posts Icon Carousel for WordPressFewer than 10 installs apply_filters( 'the_permalink', get_permalink() ) lib/class-zhu-pic-1-widget.php:165
  65. OnList icon OnListFewer than 10 installs apply_filters( 'the_permalink', get_permalink() ) inc/templates/comments.php:62
  66. Recommender icon RecommenderFewer than 10 installs apply_filters( 'the_permalink', get_permalink($post->ID) ) classes/DisplayPostsShortcode.php:356
  67. LH Native Comments icon LH Native CommentsFewer than 10 installs apply_filters( 'the_permalink', get_permalink( ) ) lh-native-comments.php:468
  68. WP AJAX Comments Template icon WP AJAX Comments TemplateFewer than 10 installs apply_filters( 'the_permalink', get_permalink( ) ) comments.php:94
  69. Recent Posts Multi-sitewide icon Recent Posts Multi-sitewideFewer than 10 installs apply_filters( 'the_permalink', get_permalink( $post->ID) ) recent_mu_posts.php:75
  70. Plugin Name: WP Submit Helper icon Plugin Name: WP Submit HelperFewer than 10 installs apply_filters( 'the_permalink', get_permalink() ) wp-submit-helper.php:60

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.