Title: Staging references live
Last modified: January 6, 2019

---

# Staging references live

 *  Resolved [Webby Scots](https://wordpress.org/support/users/webby-scots/)
 * (@webby-scots)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/staging-references-live/)
 * Hi,
 * The staging site is referencing the plugin files from the main site. My php code
   runs (I have done echos to see) only in the wp-admin area, not frontend. The 
   js files are being served from the main site – using plugins_url(). Any solutions
   I can try?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fstaging-references-live%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Rene Hermenau](https://wordpress.org/support/users/renehermi/)
 * (@renehermi)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/staging-references-live/#post-11066489)
 * Hi [@webby-scots](https://wordpress.org/support/users/webby-scots/)
 * > The js files are being served from the main site – using plugins_url().
 * If you hardcoded urls in your plugins then this cannot be handled by wp staging.
   
   WP staging can not search & replace through your files. It only makes path adjustments
   to the cloned database tables. So to prevent this you should not use hard paths
   in your code. Instead `https://hostname.com` use `get_site_url()` and so on.
 * > The staging site is referencing the plugin files from the main site. My php
   code runs (I have done echos to see) only in the wp-admin area, not frontend.
 * Do you have some real code example for me?
 * WP Staging copies the entire site into a subfolder and the clone of your site
   is 100% independent from the live site. So if you change code of a plugin on 
   the live site it’s under normal circumstances not possible that this affects 
   a plugin on the staging site and vice versa.
 *  [Frank](https://wordpress.org/support/users/t-mug/)
 * (@t-mug)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/staging-references-live/#post-11097235)
 * You could copy a helper plugin file to wp-content/mu-plugins/ which scans all
   HTML (via manipulating bufferd output) and preg_replaces occurencies of `example.
   com/` **not** followed by the staging dir name with `example.com/staging_dir`
 * One would have to take care about serialized URLs e.g. in script tags.
 * Also CSS files will usually contain e.g. background-images with links to the 
   origin’s site ressources. This is probably the cause for [this unanswered issue](https://wordpress.org/support/topic/images-and-noindex/)
   also.
 * If all this the plugin denies to deal with path issues it’s practically rather
   unreliable to use it in a SEO safe way.
 *  Plugin Author [Rene Hermenau](https://wordpress.org/support/users/renehermi/)
 * (@renehermi)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/staging-references-live/#post-11101295)
 * Hi Frank,
 * that would be a smart approach. Have to think more about this but I like the 
   idea.
 * Serialized URLs in script tags should not be an often happened issue as they 
   are generated dynamically with data either from the database which has been run
   through the search & replace method of wp staging already or with data from PHP
   constants or variables which are built dynamically.
 * If [@webby-scots](https://wordpress.org/support/users/webby-scots/) sends me 
   a real code sample I can check why his js file was returned from the main site.
   As already said, I assume it has been hardcoded.
    `plugins_url()` should never
   return the path of the main site when it is executed on the staging site.

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

The topic ‘Staging references live’ is closed to new replies.

 * ![](https://ps.w.org/wp-staging/assets/icon-256x256.png?rev=2972932)
 * [WP STAGING - WordPress Backup, Restore & Migration](https://wordpress.org/plugins/wp-staging/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-staging/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-staging/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-staging/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-staging/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-staging/reviews/)

## Tags

 * [livesite](https://wordpress.org/support/topic-tag/livesite/)
 * [WPStaging](https://wordpress.org/support/topic-tag/wpstaging/)

 * 3 replies
 * 3 participants
 * Last reply from: [Rene Hermenau](https://wordpress.org/support/users/renehermi/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/staging-references-live/#post-11101295)
 * Status: resolved