Dev & Tech Notes
Terms & Conditions ©2005-2024 TJohns.co
Top Left Text cha
Web & App Development
- Details
- Written by Timothy Johns
- Category: Problems & Bugs
- Hits: 1518
add_action( 'init', 'block_admin_access' );What's wrong with this picture? if is_admin???? It blocks the administrators you shitty coders! Remove that part or make it !is_admin and it breaks the site. This code is shit like most wordpress code.
function block_admin_access() {
if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Redirect to home page if a non admin user tries to access admin area
wp_redirect( home_url() );
exit;
}
}
- Details
- Written by Timothy Johns
- Category: Problems & Bugs
- Hits: 7801
- Details
- Written by Timothy Johns
- Category: Problems & Bugs
- Hits: 6701
Searching at WordPress.org provided nothing more than instructions on how to change PHP settings on the server via php.ini.
Go to 'My Sites' >> 'Network Admin'
Then go to 'Settings' >> 'Network Settings'
You'll find the setting, Max upload file size. Change to whatever you want.
And.... that increased the maximum upload to 2MB even though I entered 8000KB in the setting for this.
I also added this line to the wp-config.php file:
define('WP_MEMORY_LIMIT' , '8M');
Once again, still an upload error.
Looks like the problem lies within one of the plugins installed on this clients site, GD bbPress Toolbox.
REALLY???? I guess they don't think WordPress already has way too many places to define maximum file size. In my opinion, it shouldn't be up to WordPress at all... should be set on the server.
Okay, so I found the problem. It had nothing to do with WordPress, but I don't take back what I said about the extra unnecessary upload settings as they cluttered the issue.
Godaddy now uses .user.ini instead of php.ini to declare settings for the server in cPanel accounts. Here's the stupid part. If you upload the settings via php.ini they appear to change when looking at a php info file (where you upload a file containing phpinfo();).
Thanks again, Godaddy, for the confusion.