Title: Error param on get_permalink()
Last modified: November 5, 2020

---

# Error param on get_permalink()

 *  Resolved [asadowski10](https://wordpress.org/support/users/asadowski10/)
 * (@asadowski10)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/)
 * Hey team,
 * In this file [https://plugins.trac.wordpress.org/browser/wordpress-seo/trunk/inc/sitemaps/class-post-type-sitemap-provider.php#L615](https://plugins.trac.wordpress.org/browser/wordpress-seo/trunk/inc/sitemaps/class-post-type-sitemap-provider.php#L615)
   when you call get_permalink($post);
 * $post is not a WP_Post or and ID but your Stdclass.
 * In the function get_permalink() the final return has a filter :
 *  /**
    * Filters the permalink for a post. * * Only applies to posts with post_type
   of ‘post’. * * [@since](https://wordpress.org/support/users/since/) 1.5.0 * *
   [@param](https://wordpress.org/support/users/param/) string $permalink The post’s
   permalink. * [@param](https://wordpress.org/support/users/param/) WP_Post $post
   The post in question. * [@param](https://wordpress.org/support/users/param/) 
   bool $leavename Whether to keep the post name. */ apply_filters( ‘post_link’,
   $permalink, $post, $leavename );
 * If any plugins or custom code hook ‘post_link’ after WordPress SEO it can generate
   a fatal error.
 * Could you modify your code to put an ID or an WP_Post instance ?
 * Best,

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Md Mazedul Islam Khan](https://wordpress.org/support/users/mazedulislamkhan/)
 * (@mazedulislamkhan)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/#post-13626518)
 * Thanks for bringing this to our attention. While we are not sure whether this
   is something intentional or a bug, we’d love to investigate this further as well.
   So, if you have a spare moment to share with us, please do feel free to submit
   a proper bug or enhancement report directly at our [GitHub development repository](https://github.com/Yoast/wordpress-seo/issues)
   so our development team can look into this further for you.
 *  Thread Starter [asadowski10](https://wordpress.org/support/users/asadowski10/)
 * (@asadowski10)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/#post-13628373)
 * Hi [@mazedulislamkhan](https://wordpress.org/support/users/mazedulislamkhan/)
 * Job done : [https://github.com/Yoast/wordpress-seo/issues/16308](https://github.com/Yoast/wordpress-seo/issues/16308)
   🙂
 * Best,
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/#post-13628401)
 * It isn’t real issue. Function [get_permalink](https://developer.wordpress.org/reference/functions/get_permalink/)
   uses function [get_post](https://developer.wordpress.org/reference/functions/get_post/)
   which returns [**WP_Post object**](https://developer.wordpress.org/reference/classes/wp_post/)(
   converted from stdClass). So, the filter [post_link](https://developer.wordpress.org/reference/hooks/post_link/)
   contains correct object. You can see:
 * The class _WPSEO\_Post\_Type\_Sitemap\_Provider_ uses custom SQL query (to speedup
   process) on same way how it’s done in WP core.
 * I’m Yoast SEO contributor and I’ve a lot of experience related to sitemaps. I’ve
   created many PRs and customizations. I never experienced this kind of issue related
   to sitemaps (but there were issues in other parts).
 * UPDATE: It could be possible in some cases for built-in post types (page or post).
    -  This reply was modified 5 years, 5 months ago by [Saša](https://wordpress.org/support/users/stodorovic/).
 *  [devnihil](https://wordpress.org/support/users/devnihil/)
 * (@devnihil)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/#post-13659120)
 * We are going ahead and marking this issue as resolved due to inactivity. If you
   require any further assistance please create a new issue.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Error param on get_permalink()’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

## Tags

 * [apply_filters()](https://wordpress.org/support/topic-tag/apply_filters/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [post_link](https://wordpress.org/support/topic-tag/post_link/)

 * 4 replies
 * 4 participants
 * Last reply from: [devnihil](https://wordpress.org/support/users/devnihil/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/error-param-on-get_permalink/#post-13659120)
 * Status: resolved