Allow Author on Site A capability to upload files on Site B in Multi Site

Look into switch_to_blog() and its required follow up, restore_current_blog() I left comments in code for basic idea to adapt into your function. It may need tweaking, and can probably be improved. //Site B add_action( ‘init’, ‘site_a_author_upload_site_b’ ); function site_a_author_upload_site_b() { if ( is_user_logged_in() ) { //get a WP_User object of current user $current_user = wp_get_current_user(); … Read more

Image problem – Multisite image upload broken

Just change your .htaccess to this: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] RewriteRule … Read more

What is meant by Multisite in WordPress?

WordPress Multisite allows you to use one WordPress code installation to run multiple websites. mywebsite1.com mywebsite2.com mywebsite3.com etc All run from the same code, can share the same plugins, can share the same themes (but use different themes), share the same admin login (but different sites can be limited to different editors), keep all data … Read more

Redirect only posts to New Domain

Thanks everyone for taking time to look and get it solved. After so many trials and try-catch, I managed to achieve the above task by adding these lines to .htaccess RewriteCond %{HTTP_HOST} ^(www\.)?prsblog\.com$ [NC] #RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif|ico)$ [NC] RewriteCond %{REQUEST_URI} !wp-admin RewriteRule ^(.*)$ https://www.pyarb.com/$1 [L,R=301] This solved my problem for instant.

Create unique alphanumeric ID on wp_insert_post

See here the working version // function to save the randomString as custom field value function generate_AlphanumericID( $post_id ) { $postTypes = array(‘profile’, ‘article’); $postType = get_post_type( $post_id ); if (in_array( $postType, $postTypes ) ) { $characters = “0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ-_~’!,”; $charactersLength = strlen($characters); $randomString = ”; for ($i = 0; $i < 11; $i++) { $randomString … Read more

How to list WP multisite languages

Fix it by querying to wpml languages table. get all sites loop through the sites get blog ids. Query ICL languages table of each blog(each multi-site) Add into Array & play accordingly $blog_id == 1 condition used because the base site doesn’t have blog id prefix with table name Here is the function function getSitesLanguages() … Read more