Title: Need to insert PHP into custom fields
Last modified: August 20, 2016

---

# Need to insert PHP into custom fields

 *  [sb_cole](https://wordpress.org/support/users/sb_cole/)
 * (@sb_cole)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/need-to-insert-php-into-custom-fields/)
 * I need to add <?php bloginfo(‘template_directory’); ?> to my Custom Field values
   but it doesn’t work.
 * My problem is I need to insert that into/before some Custom Field text that are
   links to other pages on my site. Otherwise I get 404 errors.
 * Anyone have any idea how this can be done?
 * Thanks in advance!
    Cole

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

 *  [WP Libra](https://wordpress.org/support/users/wpbum/)
 * (@wpbum)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/need-to-insert-php-into-custom-fields/#post-2766863)
 * Do you expect your sites URL to change?
 * Just do the full URL instead of using the function.
 *  Thread Starter [sb_cole](https://wordpress.org/support/users/sb_cole/)
 * (@sb_cole)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/need-to-insert-php-into-custom-fields/#post-2766879)
 * Yeah, I need to keep all URLs relative to the site root due to a server admin
   requirement. It makes deployment more straight forward and also makes subsequent
   dev server deployments easier as well. Plus in my testing environment it would
   be specified as localhost but then I would have to go back and change all of 
   them once deployed to a production server to a different address. Not really 
   an option unfortunately.
 *  [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * (@michaelmariart)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/need-to-insert-php-into-custom-fields/#post-2766884)
 * > Plus in my testing environment it would be specified as localhost but then 
   > I would have to go back and change all of them once deployed to a production
   > server to a different address. Not really an option unfortunately.
 * You do understand that you’ll have to do this anyway for any links that are in
   your posts/pages/other content types? This may not be a concern if you’re not
   having links in your content, but I haven’t seen to many sites that don’t have
   those things somewhere. 🙂

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

The topic ‘Need to insert PHP into custom fields’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/need-to-insert-php-into-custom-fields/#post-2766884)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
