Categories

auto_wp_options

auto_wp_options

This is a plugin for my needs to simplify my wordpress installation.

I use a local installation at http://www.bretterhofer.local and then moved it to http://www.bretterhofer.at.

But there are some wp_options that need to be changed if you move to a different server.

function auto_wp_options()
{
 $siteurl=getHostUrl();
 $filesystemroot_of_wordpress=str_replace ( "\\", "/", realpath(dirname(__FILE__)."/../../../")."/");

 die("auto_wp_options: ".$filesystemroot_of_wordpress);
 $sql  = "UPDATE wp_options SET  option_value='".$global_aplicationRoot."wordpress/' WHERE option_name='siteurl';";
 $resultset = $wpdb->query($sql);

 $sql  = "UPDATE wp_options SET  option_value='".$global_aplicationRoot."wordpress/' WHERE option_name='home';";
 $resultset = $wpdb->query($sql);

 $sql  = "UPDATE wp_options SET  option_value='".$filesystemroot_of_wordpress."wordpress/wp-content/uploads' WHERE option_name='upload_path';";
 $resultset = $wpdb->query($sql);
}
/**************************************************
Some wp_options need to be adjusted

Best would be just on session start. Currently it happens at plugins_loaded

*/
add_action ( 'plugins_loaded ', 'auto_wp_options' );
//    applied to the comment author's IP address prior to saving the comment in the database.
add_filter ( 'pre_comment_user_ip','auto_reverse_proxy_pre_comment_user_ip');

add_action('admin_menu', 'my_plugin_menu');

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

nc_addfooter

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close