This filter can be useful for plugins that generate dynamic content — always using the same page / post ID for example — without bothering to hook the WordPress ‘post_link’ or ‘the_permalink’ filters to modify the URL. You could enhance this filter by testing for a specific post ID, category, etc.
1 2 3 4 5 6 7 8 |
add_filter( 'wpsso_post_url', 'wpsso_post_url_request_uri', 10, 3 ); function wpsso_post_url_request_uri ( $url, $mod, $add_page ) { return ( empty( $_SERVER['HTTPS'] ) ? 'http://' : 'https://' ). $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; } |