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. Required fields are marked *

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