Recommended File Permissions

As far as I understand it is not related to specific permissions – Auto Update overall requires that files owner matches user Apache runs under. If that is not the case it falls back to other filesystem methods (FTP, SSH) and so prompts for password. You can define credentials in constants in wp-config.php so you … Read more

How to stop wordpress from changing default .htaccess permissions to 444

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 … Read more

add_menu_page permissions – what am I doing wrong?

You want the admin_menu hook, rather than admin_init. Also, you shouldn’t use anonymous functions. Instead, use: function wpse51004_add_menu_page() { add_menu_page(‘Some Page’, ‘Some Page’, ‘manage_options’, ‘some-slug’, ‘wpse51004_some_page_callback’); }; add_action(‘admin_menu’, ‘wpse51004_add_menu_page’); function wpse51004_some_page_callback() { echo ‘Hello, world!’; }

Can’t upload images due to permissions error

@Lea, This error happens when PHP (WordPress) can’t write to the file. This is caused by not having write permissions or the username or group that PHP (WordPress) is running under doesn’t have permission to write to the file. 755 permissions will allow WordPress write permissions when PHP is running as the username under most … Read more

Add Custom User Capabilities Before or After the Custom User Role has Been Added?

There’s a reason why add_role() has the $capabilities as 3rd parameter. First some insights on what happens, when you use the function. It calls WP_Roles->add_role() – the class method The method then does a check if the role already exists. If yes, it aborts. The next step is, that it adds the role to WP_Roles->roles[] … Read more

WordPress REST API – Permission Callbacks

The issue was because I wasn’t generating and sending a nonce value with the request. In order to generate a nonce value. Localize the value of a wp_create_nonce(‘wp_rest’) function call. wp_localize_script(‘application’, ‘api’, array( ‘root’ => esc_url_raw(rest_url()), ‘nonce’ => wp_create_nonce(‘wp_rest’) )); This will then be accessible to the window object of the browser which can be … Read more

Custom Role does not have access to dashboard

You have to give the capability a true or false, like this: add_role(‘user’, ‘User’, array( ‘read’ => true )); To fix it, first remove the role and than re-add it again. remove_role(‘user’); add_role(‘user’, ‘User’, array(‘read’ => true)); http://codex.wordpress.org/Function_Reference/add_role

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)