WP get_permalink Return Wrong URL

  1. IMO It is rarely a good idea to evaluate shortcodes outside of the specific post page as too many times you need the context for either the evaluation itself or styling.

  2. Your problem is most likely related to the use of the_post and wp_reset_postdata. What is exactly the post being reset to in that case? A thumb rule, as long as you can avoid it, use explicit post ID parameters in function calls and try to avoid any assumption about which globals are being set to what. Unfortunately, some core api just do not work without the globals being set, and if you need to use them than you need need to find out what wp_reset_postdata does and maybe setup the “original” post data in a different way.

Leave a Comment

error code: 523