Tag Info

New answers tagged

1

To get all blogs/subsites a user is registered to, use get_blogs_of_user() $sites = get_blogs_of_user( get_current_user_id() ); This will fetch all sites that aren't marked as archived, spam or deleted. This will as well work in a single site environment, returning a an array with a single numerical key that has a stdClass object as value: $sites = ...


0

Q1: So which method should I use... a: Set-up the one domain as a Wordpress-Multi-site ? b: Install each Wordpress-site individually, ie, without using the Wordpress-Multi-site option ? Both will satisfy your requirement Q2: If I use (b) I gather that each installed Wordpress-site would need its own database ? Yes and no, so long as the ...


0

WordPress multisite subdomains or suddirectories? I'm not sure if you're getting the two confused. Multisite subdomains are basically fake subdomains that simply have a CNAME or A-Name record added in the DNS records. That said, and I believe one responder said this, you just need a sitemap for the root domain, and then you'll have a robots.txt that ...


0

switch_to_blog is not good solution, because of This switch is to be used for internal and admin area functions. It's too expensive a query to run on the front end. You can use this: https://github.com/ericandrewlewis/WP_Query_Multisite Edit: it's also bad solution, because in code is used swith_to_blog... So I think that there is no good solution. ...


1

You'll want to add these to your wp-config.php file: define( 'NOBLOGREDIRECT', '' ); define( 'WP_HOME', 'http://dev.domain.com' ); define( 'WP_SITEURL', 'http://dev.domain.com' ); So in its entirety, you'll have: $base = '/'; /** Multisite / Wordpress Network **/ define( 'WP_HOME', 'http://dev.domain.com' ); define( 'WP_SITEURL', ...


2

You can check existing user with "username_exists" WordPress function and insert user using "wp_insert_user" function as below for Network site also: if(username_exists( 'username' )) { echo "Username already exists"; } else { echo "Username does not exists"; $userdata = array( 'user_login' => 'username', 'user_url' => ...


1

In this case, I would suggest a server specifically for the database - a DB server. Server A & B could interact with it, and chances are, it would ease some of the tension and performance related issues with Server A.


2

You'll need to tie into template_redirect hook where you will check the site and the user and then redirect if needed. function redirect_to_subsite() { if( is_main_site() && !current_user_can('manage_network') ) { $blog_id = 5; // <<----- Update the ID to the subsite blog ID you want to redirect to wp_redirect( ...


1

There is a plugin for this: Join My Multisite Allow site admins to automatically add existing users to their site, or let users decide at the click a button. I don't know how important it is to you that the users don't know that they are in a multisite but the list of the plugin's options is very interesting: By activating this plugin, you give ...


2

blogs.dir isn't used for multisites created after WordPress 3.5. Instead everything exists in wp-content/uploads.


4

You have totally missed the naming convention when coming to the taxonomy archive pages, and most probably the same goes for your archive pages for your custom post types Here is how your taxonomy archive pages should look like taxonomy-{taxonomy}-{term}.php - If the taxonomy were sometax, and taxonomy's term were someterm WordPress would look for ...


0

you can make a plugin out of the following code that removes an email from the recipients list and network activate it function wpse158530_filter_emails($emails,$cid) { if (count($emails) > 1) { // you don't want to remove yourself if you are the author as well as admin // based on ...


0

Go to your database. Figure out what your prefix is. The default is "wp_" but this solution will change if your prefix is different. Lets use "example_" for this. Go to the your "example_options" table. Find "SOMETHING_user_roles" and change it to "examaple_user_roles"


0

You did a good job writing your own query to get all the sites/blogs, but there's also a special WordPress function you can use: wp_get_sites() If you want to get content from another site/blog you have to switch first with switch_to_blog() to make sure your query will run within the right context. (And don't forget to switch back to normal with ...


-1

i am used best solution for this problem. Just create an subdomain like 'm.site.com' and copy main site all files and folder in 'm' directory.... And see your subdomain has been created with same content... I am used this method....


1

Network Activate does pretty much what you thought it does: It activates the plugin on all sites in the network. It also takes it out of the default Plugin view on the plugins screen for all those sites, so they no longer have the option to either activate it or deactivate it. So if you're still seeing it on one of those sites, then it's either not ...


0

I ended up implementing my idea. I've described the creation of the custom input field on the Site Info Screen unter Network in this Post. Here is the complete code again: <?php // Create custom Input Field on the WP-Admin > Network > Site Info Screen // for the possibility to order sites manually add_action('admin_footer', ...


0

The problem was a redirect in site-info.php. After that the $_POST variable was empty in the code inserting in the admin_footer. I just need to use a further hook 'admin_init' and save the value here. add_action('admin_init', 'pg_save_custom_site_options'); function pg_save_custom_site_options(){ global $pagenow; if( 'site-info.php' == $pagenow ...


0

You should be able to do this using the Wordpress MU Domain Mapping plugin. I've just tested this and it seems to work if I go to the main site and login I'm then are logged in on all the sub sites. I think you might need to tweek the domain options for the plugin under wp-admin/network/settings.php?page=dm_admin_page for this to work. Reference WordPress ...


0

Are you using the subdomain option? If so, I had this same issue with Rackspace using their cloud servers. If you have your own server with them, you will need to have them setup a virtual host entry for your new site. Or you can do it if you are comfortable with ssh. If not have them do it. You can create a new file (name it domain.conf) in the conf.d ...


0

I found out if I commented out the following line in the htaccess, it resolved the problem. RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.isagenixhealth.net/$3


0

The best (and perhaps only) way to get wordpress working in a situation like the one described above (being set up on separate subdomains with the same userbase, etc) is by using the multi-site installation.


1

never saw this hack before, but that is all it is - a hack. While it might work at some situations, wordpress core do not officially supports (yet) having two domains on one network install, and therefor YMMV to what will work and what not. You are much safer having two different installs then taking this path.


0

In a multisite Installation each site is a single blog. It has its own contents and settings. If your change something in the backend of the main blog it does not have an effect on the other blog in the installation. Only if you change something in the code of the theme, it will effect all blogs, which are using the theme, because all blog shares the source ...


0

If you want wordpress to behave nice when asked to serve content from example.com you need to configure it to know that. This is done automatically at the install process for the domain on which wordpress is installed on but can also be controlled from wp-config.php by setting values to the WP_HOME and WP_SITEURL constants. What you need to do is set the ...


0

try use this function,, function get_primary_blog_url($id=null) { // is there a user to check? global $current_user; $user_id = (null != $id ) ? $id : $current_user->ID; if ( isset( $user_id ) ) { // Get the blogs of this user $user_blogs = get_blogs_of_user( $user_id ); // Get the URL of the blog foreach ( $user_blogs AS ...


2

You're right, get_current_site()->blog_id will return 1, as it refers to the network. To get the current site (blog) ID you can go like this: <?php echo get_current_blog_id(); ?> Moreover you can get the current site (blog) details like this: <?php var_dump(get_blog_details()->blog_id); ?>


0

You can use either WP_User: $wp_user_obj = new WP_User( // $user_id get_current_user_id(), // $name | login, ignored if $user_id is set '', // $blog_id get_current_blog_id() ); Or get_users(): $get_users_obj = get_users( array( 'blog_id' => get_current_blog_id(), 'search' => get_current_user_id() ) ...


0

Domain Mapping via Core You don’t need to use the domain mapping plugin if you are planning on running a WordPress Multisite with top-level domains and/or sudomains. WordPress allows you to change a sub-domain to a top level domain once you have added the site settings, see the screenshot below. Core works perfectly without Alias, more then one domain. ...


2

You could use the function switch_to_blog Example: switch_to_blog( $site_id ); $post = get_post( $post_id ); restore_current_blog(); It should do exactly what you need. After switching you can use a custom query to get the relevant information


1

According to the Codes on capabilities the manage_sites and manage_network_users should grant these options, or am I not reading correctly? Apparently, the capabilities here are not enough. Check out wp-admin/network.php. You'll see it dies if the current user fails the is_super_admin check. This check gets the $super_admins global from get_super_admins ...


0

You should rethink what you are trying to do as an email address represents with no ambiguity a specific user. Getting many users to be identified by one email can create problems as to who gets to set the password. In general if it a small amount of accounts it is probably easier to create unique email addresses for each of the accounts and just forward ...


0

You can create a folder /wp-content/mu-plugins/ and put the plugins there. Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation. Must-use plugins do not show in the default list of plugins on the Plugins page of wp-admin – ...


0

I'm not 100% sure how I fixed this, but I did. A few things I did: Make sure you clear your cookies, or test in an incognito window. Login cookies caused me some problems. I replaced my nginx rewrites with: rewrite ^/(site1/|site2/|site3/)?(wp-(content|admin|includes).*)$ /wp/$2 break; rewrite ^/(?!wp/)(site1/|site2/|site3/)?(.*\.php)$ /wp/$2 break; ...


0

It seems the problem is not with add_rewrite_rule rather with the .htaccessfile for the multi site. One of the test addresses was http://example.com/foobar/def/whatever.php Here's a part of the htaccess which causes the result (Line 2) RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] ...



Top 50 recent answers are included