URL Rewrite fires when retrieving a custom value?

I’m working on an old WP Multisite instalation (3.0.1) and something weird is happening.

The guy who built the site made a decision to store direct URLs instead of Post IDs to a Custom Field. And this is creeping me with:

Read More
// String stored on the database: `http://example.com/wp-content/uploads/2012/07/filename.pdf`
// Code
$cf = get_post_custom($post->ID);
$pdf = $cf['meta_key'][0];
// Result
$pdf == 'http://example.com/wp-content/sitename/files/2012/07/filename.pdf' // true

Any ideas why this might be happening? Why is the URL string being rewritten?

Related posts

Leave a Reply