Compare $current_site->id
with $current_site->blog_id
. According to the in-line documentation, blog_id
should be working … but check to see if there’s a major difference there (your system might have a plug-in or something else causing a problem).
Update – Ignore last
It seems like $current_site
is a global variable defined by your site or network and will always return the same blog_id
as your network dashboard – in this case, “1.”
What you need to use instead is $current_blog
:
function get_image_list() {
global $current_blog;
$dir=is_multisite() ? 'wp-content/blogs.dir/'.$current_blog->blog_id.'/files/' : 'wp-content/uploads/';
$url=is_multisite() ? get_bloginfo('url').'/wp-content/blogs.dir/'.$current_blog->blog_id.'/files/' : get_bloginfo('url').'/wp-content/uploads/';
That should get you the right information.
Related Posts:
- How do I create a custom role capability?
- Prevent network activation of plugin
- Uninstall script for a plugin in Multisite
- Changing Plugin Load Order
- What is wrong with using add_option with Multisite instead of add_blog_option in a plugin
- How to Get a List of Sub Blogs without Using get_blog_list()?
- Cron firing my function everytime wp-admin is visited
- How do I make specific plugin functionality apply to different sites in a network?
- WordPress multisite apply different options over each site from same plugin
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- Multisite, sharing content by URL
- Only allow plugin to be activated on root site of multisite
- How to use wp_set_password in a plugin?
- WordPress Media mime type filter problem 4.0
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Where should I store global data for my multi-site WordPress plugin?
- unable to stop loop when using wp_insert_post with publish_post hook
- Customize multisite site creation with user data
- Multisite plugin development and wp_enqueue_script
- Plugin Uninstall and Deactivate via Options Menu
- how to activate plugin network-wide, and save setting across sites
- Sharing a common set of image files for media library, across all sites within multisite
- What is difference between blog id and site id?
- How to create a Tools menu on the Network Admin dashboard from a plugin
- Override the default Add/Edit site forms of the Network Panel in custom plugin
- How to set “Site Address (URL)” programmatically on WP multisite?
- How to associate an existing user to a site in a multisite setup programmatically
- WordPress Multisite with Azure B2C redirect_urls after Login
- How To Change Post Author Default?
- Adding (blog-specific) links to “My Sites” admin page
- Plugin menu addition in multisite
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Multiple Plugin best practice in Multisite
- Selectively update themes in WordPress multisite
- Problem with context in multisite – getting main site data in every blog (get_pages())
- how to invoke wordpress API from other existing PHP system
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- register_activation_hook on multisite
- WordPress multisite,use same cookies across all website?
- WP: Search and replace in DB programmatically
- How to get current logged-in user details in multisite?
- add_action wp_ajax_ not loading in plugin file WP Network
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to share user data across multiple WordPress websites?
- Is there anything special required to make a plugin work in a multisite environment?
- How to edit wp-signup.php content using plugin
- How do I ensure I can loop through every enqueued script and CSS?
- Custom Plugin activation error in Multisite
- Replace “content-area” of themes 404 page with plugin?
- Multisite and the JSON REST API: How to?
- Testing Plugins for Multisite
- Same header/footer in Admin, across all network sites in multisite
- Change Admin menu placement using hooks
- Force remove parent theme CSS/JS and call them from Child theme
- How to add Request header in WordPress remote api calls
- Init action hook running late after PayPal’s return url?
- Get specific color from admin color scheme
- wp_remote_get doesn’t work with secure connections https?
- Change WordPress.org hosted plugin readme.txt
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- Sessions not creating correctly in custom function
- Problem with `wp_mail()`
- How to add meta boxes to the ‘Add new post’ screen?
- Load WooCommerce templates from my plugin folder first
- add_menu_page() with function inside a class [duplicate]
- Cannot modify header information – headers already sent by pluggable.php
- htmlentities and editing text
- Gutenberg registerFormatType with Multiple Classes
- Best way to notify WordPress plugin users of new release candidates for beta testing?
- How to update total price of completed order in woocommerce? [closed]
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Turn off Admin Bar (Toolbar) in backend – no easy way
- When to use add_settings_section vs just register_setting?
- How to customize login process
- How should I store a log for my plugin
- Adding more text to a post, after it was published
- How to modify the comments to be displayed in a post?
- wordpress how to query wp_options table
- How to only load css for used blocks on frontend
- adding wp-cli commands to plugin: how to document to users?
- Creating an empty page programatically
- Multiple API Endpoints (wp_remote_get)
- Make dynamic string translatable
- wp_schedule_event is registered but function isn’t running
- Simple plugin don’t display content
- How to make an admin plugin menu page go full screen?
- Woocommerce get_term_by() in transition_post_status hook doesn’t works
- Home page is not loading, where in other pages are displaying on the site
- Custom table / Alternative to WP_List_Table
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- tweaking the
- external Integration with wordpress timeout error
- Problem to return more than single line captions
- Use plupload to upload images and save them to custom folder and database table
- How to add conent (text) to Add New pages form of admin in WordPress
- Open media box library from link
- Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php
- How to get locale within WP REST Request?
- How to add extra EXIF data when images are uploaded?