How can I (easily) determine which of my wordpress sites are using a given plugin, on a Wordpress Multisite install? Let's say I have 1,000 wordpress sites on a Wordpress Multisite install. I have 100 plugins. For each plugin, I want to list all of the sites that are using that plugin. In the GUI, I can only see how this can be done in about 1 million clicks. Is there a query I can run against the DB (and …
I need the site to be in maintenance mode while I complete a cron job within a plugin. I have solved this by creating a ".maintenance" file in my plugin directory and using the following code in my cron job: $plugin_dir = ABSPATH . 'wp-content/plugins/my_plugin/'; $base_dir = ABSPATH; $static_maintenance_file = $plugin_dir . '.maintenance'; $new_maintenance_file = $base_dir . '.maintenance'; copy( $static_maintenance_file, $new_maintenance_file ); // do the business end of the cron job unlink( $new_maintenance_file ); It works as designed. However, it …
I have a snippet that redirects all users to a maintenance page. How can I tweak it to All users except admin users? <?php add_action( 'template_redirect', function() { if ( is_page( 4848 ) ) { return; } wp_redirect( esc_url_raw( home_url( 'maintenance/' ) ) ); //wp_redirect( esc_url_raw( home_url( 'index.php?page_id=4848' ) ) ); exit; } );
Forgive my "beginnerness" in this matter but I have 2 options to trigger a heavy task (massive update on users' properties to solve an issue between 2 plugins that weren't meant to cooperate): (1) Use Unix Cron in my server OR (2) Use WP-Cron I do prefer to do everything IN WordPress and use WP-Cron if they are similiar but (from my undestanding) since wp-cron is a pseudo-cron that waits for some visitor to come and trigger it, I fear …
I want to set the site into maintenance mode without using a plugin so that anyone who accesses the site who is not a site admin will see a "sorry site under maintenance" page. I created a .maintenance file with the code below: <?php function is_user_logged_in() { $loggedin = false; foreach ( (array) $_COOKIE as $cookie => $value ) { if ( stristr($cookie, 'wordpress_logged_in_') ) $loggedin = true; } return $loggedin; } if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], …
I have a site which requires a lot of maintenance - hence I plan to give those tasks away to some acquaintance ppl. They need to have access to some submenus of plugins which do not implement proper permission management - which is something I have seen very often. Usually some general permission-request like "manage-option" or similarly is used, which is a pretty bad design. Now I'm thinking, without modifying the plugins code, how can I give permission to someone …
I inherited a couple of WP + WooCommerce shops with roughly 30,000 products for sale each, and a wp_postmeta which is over a million lines. The former webmasters ran away. In an effort to clean up old stuff, I noticed a post_parent field in wp_posts, and queried the database for orphans: SELECT ID FROM wp_posts WHERE NOT post_parent IN (SELECT ID FROM wp_posts) AND post_parent>0 and found thousands of records. All of these records have a post_parent which no longer …
There are a bazillion plugins that does this. And every time I use one, I end up spending hours trying to style the message (and logo and background) to fit the styling of the page. So I was wondering if I could make one easily myself, by using this function: function custom_maintenance_page() { if ( ! is_user_logged_in() ) { if( $_SERVER['REQUEST_URI'] != '/under-maintenance/' ){ wp_redirect( 'https://example.org/under-maintenance' ); } } } add_action( 'template_redirect', 'custom_maintenance_page' ); And then making a new page, …
I'm using https://de.wordpress.org/plugins/wp-maintenance-mode/ . I need to test the wp-admin page with different user roles while in maintenance mode. When I switch to a different role than admin the maintenance screen shows up. Is there a way to test the wp-admin page with a different role while in maintenance mode?
Does anybody know a solution or smarttrick to maintain lets say 100+ forms on wordpress websites from 1 main location. So lets say i have 500 websites with the exact same contact form and i would like to add 1 field to all of them at the same time it would take me 10 minutes instead of a complete day.
When WordPress does plugin/theme/core updates, it creates a .maintenance file which temporarily puts the site in maintenance mode. Sometimes this file does not get deleted and users are locked out of their site (until they search and find that they have to delete that file). As plugin developer it's frustrating because I regularly get blamed for breaking their site. My question: Under which circumstances is the file not deleted? Is there anything I, as a plugin developer, can do to …
The company I work for has an enterprise Wordpress site that was acquired from a different company. I don't know if there was a past hack or if it's just accumulated spam or what, but the wp_redirection_404 table has grown to roughly 7GB. I tried grepping the table for Viagra, Versace, Nike, etc. and got pages of results for each. It's obviously full of junk. It doesn't appear to be doing anything. In fact, when downloading it locally to work …
I was updating my plugins, after one plug in update went a bit wrong my site was stuck in maintenance mode, the solution I found online was to delete the .maintanence file, which I did. But straight after that I got this message: The site is experiencing technical difficulties. Please check your site admin email inbox for instructions. How do I fix it now?..
I used this code for several years now: add_action('wp_loaded', 'check_maintenance_mode'); function check_maintenance_mode(){ global $pagenow; if(defined('IN_MAINTENANCE') && IN_MAINTENANCE && $pagenow !== 'wp-login.php' && !is_user_logged_in()){ header('HTTP/1.1 Service Unavailable', true, 503); header('Content-Type: text/html; charset=utf-8'); if(file_exists(WP_CONTENT_DIR . '/maintenance.php')){ require_once( WP_CONTENT_DIR . '/maintenance.php' ); } die(); } } The IN_MAINTENANCE and WP_CONTENT_DIR constants are initialised and setted by me. Anyway, this code suddenly stopped to work. The website is always visible even with IN_MAINTENANCE setted to true. By logging from the function, I can confirm …
I need to redirect a whole WordPress site to a single WordPress page. A sort of maintenance mode, but the redirect has to go to a published WordPress page. Unfortunately, the maintenance page I need to show has to use other WordPress plugins. I am not aware of any Maintenance Mode plugin which lets you do this. At most, they let you write custom HTML/CSS code. I was thinking about a .htaccess mod_rewrite rule. However, I am very weak with …
The recent security Update to WP 5.0.1 also brough an update with Version 4 to 4.9.9. I got a clients project which where build on swamp land ages ago. Every Update is Hoping nothing will happen. Now i do think of staying with WordPress 4 for my maintained nightmare project, if they still develop important security updates. There is also the classic editor Plugin, which isn't working for every case. Got already another Project where an very old unmaintained Plugin …