Closed DBPreston closed 12 years ago
odd.. similar to https://github.com/retlehs/roots/issues/120#issuecomment-3602221
got_mod_rewrite()
is also a wordpress function..
are you trying on a fresh install?
No, it's my testing server, which has been installed a while and has had umpteen different themes at one time or another. I haven't manually done anything at core files, though, and the function is declared in wp-admin/includes/misc.php as it should be.
how did you get the error to trigger? or is it always present?
i was able to reproduce this error after re-activating a plugin, but it's different than yours:
Fatal error: Call to undefined function get_home_path() in /wp-content/themes/evaluatorgroup/inc/roots-htaccess.php on line 70
what plugins do you have running? you can get it working for now by editing https://github.com/retlehs/roots/blob/master/inc/roots-htaccess.php#L55 and changing the filter to admin_init
, so it would be:
add_action('admin_init', 'roots_add_h5bp_htaccess');
another fix that works:
add add_action('activate_plugin', 'roots_add_h5bp_htaccess');
and if (!function_exists('get_home_path')) return;
we're going to try and figure out the best solution before pushing any new code for it
Is this wp bug? I keep getting get_home_path - undefined now and then. Last time I clearly remember i was saving changes settings on the WordPress SEO plugin (yoast). Quite random, really. I've done several fresh installations (even on different hosts) since first I got that error and with all of them it starts to fail after some moderate configuration and usage. Now that fix is keeping it together but still it's just preventing the error to be thrown, right? So on rules generation i won't be able to get the boilerplate stuff anyway.
I've just recently got this error when trying to install the Events Manager plugin. The only way to get rid of it was to delete the plugin via ftp and activate a different theme and the re-activate roots.
I uploaded the new roots-htaccess.php file but it hasn't fixed it for me. Has anyone used Roots with this plugin? I'd love it to work, but I am unsure what isn't playing ball here- Roots or the plugin or a combination. Any ideas?
@baritoneuk can you try changing L56 in roots-htaccess.php from
add_action('activate_plugin', 'roots_add_h5bp_htaccess');
to
add_action('admin_init', 'roots_add_h5bp_htaccess');
@retlehs thanks, but unfortunately I still get the same error:
Fatal error: Call to undefined function got_mod_rewrite() in /home/xxxx/public_html/wp-content/themes/iag/inc/roots-htaccess.php on line 79
pinging @alkymst
Let me look at how the events manager plugin is adding htaccess rules. My guess is they are stomping on eachother. Do you have the modified htaccess file after it blew up that you can send?
@alkymst The issue happens as soon as I activate Events Manager. I get a PHP error (as above). I can't access the WP Dashboard. So I delete the plugin using ftp, then I can access the dashboard but the site gives the same error. I then switch themes and then back to roots and that gets rid of the error. The .htaccess file is unchanged by activating the plugin.
Can you try using this roots-htaccess.php? https://gist.github.com/1755053
Unfortunately that hasn't worked either. I activated the Twenty Eleven theme and the installed and activated the Event Manager plugin and it activated without any issues. I then activated my Roots theme and again no problem. Unfortunately when I changed any of the settings within the Event Manager plugin it triggered the above error again. I really don't know what is causing the error. My .htaccess file isn't being modified so it can't be that.
Try that revised roots-htaccess.php again, some how I pasted in the old copy. Here is the link again. https://gist.github.com/1755053
@alkymst fab! That works for me. What was the issue and the change?
@baritoneuk All the function "got_mod_rewrite" does is return true or false, if it's not loaded, it means that something within the plugin is loading outside of the admin flow, yet triggering the "generate_rewrite_rules" action. It's probably an order thing, if we keep seeing it pop up we can look in to the order of actions and filters.
So what I did was:
$mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
Which returns false if the function doesn't exist.
Than I changed:
if(got_mod_rewrite()) {
// then move on as planned
}
to:
if($mod_rewrite_enabled) {
// then move on as planned
}
I'll submit a pull request in a little while.
thanks @alkymst ..saved me a lot of time here!
Just a small note for anyone like me coming late to the game - I was releasing a project that I thought was dead (clients disappeared for a long time and)... Roots has changed quite a bit since then around the time that this thread was active. The gist from @alkymst https://gist.github.com/1755053 totally saved me - I don't know about it's compatibility with newer Roots versions, but upgrading from WP v3.2(???) to 3.4.2 broke my install and gave me Call to undefined function get_home_path() ... /inc/roots-htaccess.php on line 7
after updating roots-htaccess.php
This this thread also touches on the same error and just referencing in case someone else has this issue, that gist is a lifesaver.
retlehs-roots-c7b59bc
Fatal error: Call to undefined function got_mod_rewrite() in D:\wamp\www\wordpress\wp-content\themes\retlehs-roots-c7b59bc\inc\roots-htaccess.php on line 74
Could be something to do with my installation, dunno.