Specific upload folder for PDFs in custom Post type in WP multisite

you might consider using if(get_post_mime_type($id) == ‘application/pdf’){ … } to check for pdf files. http://codex.wordpress.org/Function_Reference/get_post_mime_type You might also take a look at the code behind the wp_delete_attachment() function and you can hook into it with the delete attachment action. To remove the files you can use unlink() http://php.net/manual/en/function.unlink.php

How to use same email for multiple users

You can use wpmu_validate_user_signup filter to remove the error and then define WP_IMPORTING just to skip the email_exist() check in wp_insert_user() function: add_filter(‘wpmu_validate_user_signup’, ‘skip_email_exist’); function skip_email_exist($result){ if(isset($result[‘errors’]->errors[‘user_email’]) && ($key = array_search(__(‘Sorry, that email address is already used!’), $result[‘errors’]->errors[‘user_email’])) !== false) { unset($result[‘errors’]->errors[‘user_email’][$key]); if (empty($result[‘errors’]->errors[‘user_email’])) unset($result[‘errors’]->errors[‘user_email’]); } define( ‘WP_IMPORTING’, ‘SKIP_EMAIL_EXIST’ ); return $result; } UPDATE: for … Read more

Site admin in a network install can’t edit users?

As explained in the description of the Network Admin Users screen, in a network install (multisite mode) users are added on a global basis to the entire network, then assigned to specific sites Normal administrators are not permitted to modify these global profiles, since their privileges extend only to their given site. This task is … Read more

Why are my roles not visible in a Multi-site/Network?

Determine your Multisite Blog ID. I will use 99 as an example Go into the database Go to this table: wp_##_options (wp_99_options) — you will have a table for each blog Find the record where option_name = wp_user_roles Change the text wp_user_roles to wp_##_user_roles (“wp_99_user_roles”) The table you are editing will have option_id, blog_id, option_name, … Read more

Remove the blog slug from WordPress Multisite root node

At blog site set Settings -> Permalinks -> Common Setting -> Default (Must select default only and don’t touch any thing, If you need to change category base, tag base set at Network Admin only) At Network Admin -> Sites -> (root site) Permalink Sturcture -> /%category%/%post_id% That it will remove /blog slug

How can I trust switch_to_blog()?

@G.M.’s idea to cache the check has lead me to the following helper function. I’ve put it into the global namespace to have it available everywhere. The function doesn’t say anything about the blog status, just if it exists and is not marked as deleted. The database query is very fast (0.0001 seconds) and runs … Read more

WordPress Job Interview Preparation

If I were to hire a WordPress developer, my wish list would look like this: Knows HTML and CSS inside and out; Has at least a basic grasp of JavaScript; Knows their way around PHP, and produces beautiful code (clean, consistent, DRY) Has a good grasp of database design and SQL: if I show you … Read more

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