New answers tagged

1

You can dynamically update the WP_HOME and WP_SITEURL constants in wp-config.php to reflect the requested host: define( 'WP_SITEURL', 'http://' . $_SERVER[ 'HTTP_HOST' ] ); define( 'WP_HOME', 'http://' . $_SERVER[ 'HTTP_HOST' ] ); As long as visitors don't click a link containing a different fully-qualified domain (or otherwise send a request to a ...


0

It will be a problematic thing to do as it will require you to let the webserver run scripts as a system root. It is somewhat hard and requires a lot of thinking security wise about the implications of letting a web server do it. But you are spared of all that thinking ;) as your scheme is not practical as wordpress MU always runs as the webserver user and ...


-1

You can do that with update_field() function. Read more here acf update field


0

The wpseo_opengraph_image filter can only be used to modify the existing og:image. Otherwise, you will need to hook into the wpseo_opengraph action to add a different image. Here's an example of adding an image from a custom field on the post object (assuming you're using ACF here). function my_wpseo_opengraph() { global $post; if (isset($post)) { ...


1

Outsource this function into a Plugin If you want a specific function available across multiple themes, it is best to have it in a Plugin, and activate it networkwide. Find the function Locate the function in the theme where it is available. You now have two possibilities: Delete the function from the current theme Make a duplicate of this function to ...


0

How can you have a site at http://angelcard.example.com/logmein? The address isn't invalid. For the other link you provided http://angelcard.com.au/logmein DNS does not resolve, at least from my connection. It also does not resolve from AWS in N. Virginia. /usr/home/bill/> nslookup angelcard.com.au Server: 216.92.61.41 Address: ...


2

This Plugin gives you a list of posts for each Site already, but it does not exactly do what you want to do. Basically, it gives you a list of all posts in your network. What you need to do afterwards is sort them by site_id and create an output for that. I do not know if this is the best version - but as WP_Query returns an one-dimensional array, you need ...


0

After a bit of debugging, I was able to narrow this down to the following: The menu that I had created to display across each site in the network was comprised of Custom post types that were not registered on any other subsite, only the main site (1). For whatever reason the custom post type must be registered on each site in the network where you will ...


0

Thanks to @Sorin for posting the trac. From there I found a solution using just filters in functions.php (so no editing the core) Thanks @mensmaximus for posting there: Link: https://core.trac.wordpress.org/ticket/33887#comment:3 <?php add_filter( 'network_admin_url', 'mmx_network_admin_url', 1, 2 ); function mmx_network_admin_url( $url, $path ){ ...


-1

I managed to disabled the plugin but it was still there on the main site panel. The only solution I found to completly remove it from the main site was to check on the main.php of the plugin the site and disable it according to it: global $current_blog; // Only available to B if( $current_blog->blog_id == 2 ) { define( 'AB_PATH', __DIR__ ); ...


3

domain_exists() is something you probably won´t call by yourself. It is used in the registration/creation process of new sites in a Multisite installation. There it´s used to check if a specific blog URL is already in use: if ( domain_exists($mydomain, $path, $current_site->id) ) $errors->add( 'blogname', __( 'Sorry, that site already exists!' ...


1

As I was migrating from a multisite install, the problem was due to the fact that roles are named based on table names. So I solved my problem when I named option wp_7_user_roles to wp_user_roles.


4

Some of the more archaic code is still present in WordPress, notably globalising variables inside functions. A good example of thise is get_current_blog_id(), which is present in wp-load.php: /** * Retrieve the current blog ID. * * @since 3.1.0 * * @global int $blog_id * * @return int Blog id */ function get_current_blog_id() { global ...


-1

If your setup is the same every time (subdomain install), then you may be able to paste the entire chunk in your first step: define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', true ); define( 'DOMAIN_CURRENT_SITE', $_SERVER[ 'HTTP_HOST' ] ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', true ); define( 'BLOG_ID_CURRENT_SITE', ...


0

I've ruled out this being an issue with Advanced Custom Fields, so I've made a new question. For more information, please look at: wp_get_attachment_image_src multisite issue


0

I am not sure how you are activating theme on Network but here I am considering a case of installing fresh theme on a existing Network. Activating theme on any single site will insert the term for every site in Network but yes of course taxonomy registration code should be there already. Consider this example function after_switch_theme_callback() { ...


2

As cdn.mydomain.com is not part of your WordPress network, it wont be affected by your settings. The COOKIE_DOMAIN constant should only be used if you want to serve cookies from a single domain for all your sites in the network. If you omit the constant or set it to an empty value, cookies will belong to the domain their requested from. Thats the ...


0

This happened because WPMU has an admin account that defaults to the same URL as the install. So my admin user, who is also the default user, let's call him "adminUser", could log in at http://www.example.com/blog/ He could update, add new posts, whatever and his posts show up at: http://www.example.com/blog/ But when new user, let's call him, ...


-4

Yes. Yes they can. In my testing and throughout the code you see switch_to_blog(another_blog); do_something(); restore_current_blog(); If you weren't able to do that I think WP would not run.



Top 50 recent answers are included