Modifying sunrise.php for WPML compatibility

Hello !

The new DM & Multidomain plugin come with a new concept of Sunrise.php.

So the one in /wp-content/ just call the one in the DM plugin folder /inc/



We absolutlely need to include int sunrise the modifications to work correctly with WPML in the REAL sunrise.php.


BUT. (yes, there is one :p )

- Modifying directly the sunrise.php file in the plugin directory is not really a good idea since modifications will go on updates.

- It is not possible to modify the sunrise.php in the /wp-content/directory, since the plugin automatically rewrite it to call the "real" sunrise.php

- it is not possible, consequently, to put the "original" sunrise.php directly in /wp-content/

So :

Would it be possible to :
- Or having the possibility to modify this file so we can put the real sunrise.php out of the plugin folder

- or, even better, directly integrate the /inc/tools/sunrise.php functions included with wpml so we can directly work with it (ie map a domain on a language in ONE particular site in a multisite install).

Cheers ! :slight_smile:

  • Aphrodite
    • The Reaper

    Thanks for your answer :slight_smile:

    But indeed it does not solve the issue.

    The problem is not hacking the original file, which can be done easily, but to hack the "false" one in /wp-content/ to redirect to another place for the original file. The plugin has changed since this thread :slight_smile:

  • Jose
    • Bruno Diaz

    Hi there @Aphrodite,

    At a first glance, I don't see any issue on changing the sunrise path on the include logic.

    Assuming that your modified sunrise file is called custom_sunrise.php and it is located under ../wp-content/, changing the sunrise.php proxy to the following code should work just fine:

    $sunrises = array(
    	"dm_sunrise" => defined( "WP_PLUGIN_DIR" ) ?  rtrim( WP_PLUGIN_DIR, '/\\' ) . "/custom_sunrise.php" : dirname( __FILE__ ) .  "/custom_sunrise.php",
    	"md_sunrise" => defined( "WP_PLUGIN_DIR" ) ?  rtrim( WP_PLUGIN_DIR, '/\\' ) . "/custom_sunrise.php" : dirname( __FILE__ ) .  "/custom_sunrise.php"
    foreach( $sunrises as $sunrise ){
      if( is_readable( $sunrise ) ){
    	include $sunrise;

    Anyway, as I didn't had the chance to through the code checking the implicanes of this change, and I didn't had the chance to test it neither, I'll call the lead dev @Sam to have his input.

    He will be able to answer also about integrating your customization into the live version of the plugin.

    Hope this helps in the meantime!


  • Jose
    • Bruno Diaz

    I see the problem now :slight_smile:

    In that case, you can either change the sunrise.php file permissions to read only, or modify the file version to a higher value by changing this:

    into this:

    Let me know if it works fine with this workaround.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.