register_theme_directory() not working from mu-plugin
register_theme_directory() not working from mu-plugin
register_theme_directory() not working from mu-plugin
So this is how I have my structure setup to attempt to create a mu-plugin for my page. This statement does not make sense. Here is what I’m using: – Genesis Framework – Genesis FrameWork Child Theme mu-plugins have nothing to do with the Genesis framework. The Genesis framework is just a parent theme like … Read more
Using the get_template_part method within an mu-plugin not possible?
I found the issue with the code: The code is good and basically works. The only thing is: There are specific plugins, if installed, which request the option of activated plugins and WRITE it back to the database to “sort” the order of activation. E.g. WPML, which needs/wants to be activated as soon as possible. … Read more
This is a classic XY problem question, the original problem you face is: “How do I prevent a client from disabling the woocommerce plugin” For which mu-plugins was your solution, to which you are now asking for a fix for your solution, aka a fix for a fix, never a good sign. So addressing your … Read more
I have solved my problem by adding $myCode -> change_url(); and add_action(‘wp_head’, array($myCode, ‘print_header_scripts’)); <?php class some_code { function change_url() { $domain_name = $_SERVER[‘SERVER_NAME’]; $country_code = get_country_code(); if ($country_code == “PK”) { header(“location: http://///////////////”); exit(); } else if ($country_code == “AU” && $domain_name !== “au.cacricketbats.com”) { header(“location: https:///////////////////” . parse_url($_SERVER[‘REQUEST_URI’], PHP_URL_PATH)); exit(); } } function … Read more
Your question boils down to simple PHP. It is basically how to avoid ‘AdminUser’ !== $user->user_login || ‘AdminUser2’ !== $user->user_login || ‘AdminUser3’ !== $user->user_login || ‘AdminUser4’ !== $user->user_login || etc. One way to solve this is use in_array() instead: $allowed_users = [ ‘AdminUser’, ‘AdminUser2’, ‘AdminUser3’, // etc ]; $user = wp_get_current_user(); if($user && isset($user->user_login) && … Read more
The reason you are advised to put a custom post type in a plugin rather than your theme is that in this way the user can keep the cpt even if he decides to switch to another theme. In five years or so, design trends may change significantly and you don’t want to be stuck … Read more
No, mu-plugins cannot be updated from wordpress.org. When you submit a plugin to that repository, it will be available as a regular plugin only. You can ask your users to isntall it as a mu-plugin, but they will not receive updates then. The “other code” should be written in a way that it doesn’t do … Read more
Per comments, declare it global before using in both (or all) places: global $sitetype; if ( $_SERVER[“HTTP_HOST”] === “domain1.com” ) { $sitetype = one; } //etc and global $sitetype; if ( $sitetype == all ){ echo “site type 1”; } //etc