Hot answers tagged

2

I can guarantee that somewhere on your technology stack (edge CDN, Firewall, Web Server, WordPress Plugin) that you have something configured that throws a 403 error whenever you try to access a URL on your site without the User-Agent Header set. Hence why it works when you access in the browser (as this will contain the User-Agent Header) and why it is ...


1

It's because you're not actually putting the result of ltrim() and rtrim() back into the variable. Those functions return the trimmed value, they don't modify the passed variable. So you need to do this: $post_url_rel = wp_make_link_relative(get_permalink( $post_id )); $post_url_rel = ltrim($post_url_rel, '/'); $post_url_rel = rtrim($...


Only top voted, non community-wiki answers of a minimum length are eligible