Tag Info

Hot answers tagged

6

The only prerequisite for current_user_can() is an existing wp_get_current_user(). The latter is defined in pluggable.php, so you can use it after plugins_loaded. The _doing_it_wrong() call you are citing in your question is wrong for itself. My guess is that you took that from BuddyPress or bbPress. Both are running into a recursion if they don't wait that ...


3

Thanks @kaiser but not need to go through your solution I found a easy one and I'll share here for newbie likes me. If you're working on a WP Network site then the steps are: At the top, hover over My Sites and then click Network Admin. At the left, hover over Settings and then click Network Settings. Scroll to the bottom of the page and change the Max ...


3

Okay here we go. It is a bug in WordPress itself. I have already shortly explained the issue in my question, so either have a look at it or check out the ticket linked above for more details. Until the issue is properly resolved I propose this dirty, dirty hack. It is based off the idea that as soon as another sub-menu that is accessible is added ...


2

I found the answer, dropping it here in case someone need it. You need to be logged in as a user that has the edit_posts capability. With that capability, you also get access to the private query vars, including post_status. Taken from this similar issue.


2

Your site has likely been hacked. My site had the Darkleech infection, which injected some malicious code into wp-includes/nav-menu.php, causing .htaccess to reset to 444 on any page load. I'd recommend you install the Sucuri plugin and let it restore any files that have been corrupted. Assuming your site was hacked, use their Post-Hack tab to reset ...


2

Clear your browser cache or use another browser to load the site, this may be a cache issue.


2

Plugins that would do this are: WPFront User Role Editor -- free & paid both do what you're asking User Role User Role and Capabilities Or you can write it into your theme's functions.php consult Roles & Capabilities in the WP Codex for the details and read this easy-to-understand guide on how to add those capabilities yourself Personally, ...


2

This is more server config question than WordPress. Make sure the www-data group has write permissions in the directory you're running WordPress from. Assuming it's in /var/www/ then sudo chmod -R g+rwxs /var/www/ should do the trick.


2

If you add the following to your wp-config.php file it will force WordPress to use the 'direct' filesystem method: define( 'FS_METHOD', 'direct' );


2

I found the problem. In settings > media the folder for uploads was actually pointing to a different path. Once I redirected it to wp-content/uploads it all worked.


1

Do you have any kind of cache plugin used? Perhaps to help speed up the website. If Yes that just may be the issue here. Another suggestion is change the current active theme to any default WP theme (twentyThirteen, TwentyFourteen), and then see if Preview give you an issue. If it does not, then its possible that there is an issue with your current ...


1

If you need to change the template used, you can use the template_include filter (change "itermediate-template.php" and "page.php" with correct file names of your template files): add_filter( 'template_include', 'cyb_exclude_template_for_editors', 99 ); function cyb_exclude_template_for_editors( $template ) { $user = wp_get_current_user(); if( ...


1

There's a filter named 'upload_size_limit' where you should be able to change the value. Just add a small mu-plugin for that job: <?php /** Plugin Name: (WPSE) #177620 Alter Upload Size Limit */ add_filter( 'upload_size_limit', function( $limit = 0, $u_bytes = 0, $p_bytes = 0 ) { return ( in_array( get_current_screen()->base, array( /* Add ...


1

First, choose one wordpress role your writer'll have : author, contributor, editor... or a custom role. then customize your chosen role with capacities in your functions.php theme file : if ( ! function_exists( 'writer_set_roles' ) ): function writer_set_roles() { global $wp_roles; // post / page editing ...


1

This is treading very close to being off-topic as it asks specifically about a particular plugin, but the answer is quite generic: You can remove the capabilities you don't need. function remove_cap_wpse_186316(){ remove_cap( 'yourwoorole', 'yourwoocap' ); remove_cap( 'yourwoorole', 'yourwoocap1' ); } add_action( 'admin_init', ...


1

This is right. You can use Wordpress in exactly the same way as you were using your OLD CMS. Wordpress is being used by Top newspapers / magazines and websites and they've editors / authors and bloggers and ofcourse they have groups & roles. CNN, Mashabale, TechCrunch, etc are all based on Wordpress. There are Free and Premium both type of plugins to ...


1

Wp-content contains plugins and themes. So, if I can read and write into those files, I could add malicious code very easily. This malicious code can then do interesting things. You are basically inviting a lot of trouble. As for not understanding permissions: http://www.thegeekstuff.com/2010/04/unix-file-and-directory-permissions/ ...


1

You're using the admin_init hook to add menus - use admin_menu instead. The init hook runs early enough for wp-admin/menu.php to add it to the sidebar menu, but not for the plugin page loading in wp-admin/admin.php In other words, when you actually try to load the plugin page, your menu code hasn't fired and WordPress fails with that rather generic error.


1

I'm inclined to think that BuddyPress and bbPress should be checking something else before issuing the _doing_it_wrong message I changed both routines to also check the actual setting of $current_user. global $current_user; if ( is_null( $current_user ) ) { _doing_it_wrong( ... ); } The Notices were no longer displayed. The testing for ...


1

If you check user capability before init means there're chances you are the responsible for the setting of the current user object. If you access user after init, then you are sure that something else already setup the user, most the times core itself. This is why accessing user after init is considered safe. In fact, early access may possibly break some ...



Only top voted, non community-wiki answers of a minimum length are eligible