I experienced a similar problem with an Ajax request. There are a couple of important things to note.
Allow me to first state the obvious:
Make sure that your code using the option_active_plugins filter is inside your mu-plugins folder. It will not work for if your plugin is a regular plugin. Not even if you name it aaaa-first-plugin.
Now for the problem I faced:
I had written my function like this:
add_filter( 'option_active_plugins', function ( $wp_enabled_plugins ) {
// Quit immediately if in admin area.
if ( is_admin() ) {
return $wp_enabled_plugins;
}
// do other stuff
});
The problem is that when doing an AJAX call, is_admin() returns true. So I changed it to:
if ( is_admin() && !DOING_AJAX ) { ... }
Everything works fine for me now. Hope it helps someone.
Related Posts:
- to perform the requested action wordpress needs to access your web server. please enter your ftp
- Hide prices and checkout functionality in woocommerce
- How do I exclude plugins from getting automatically updated?
- How to check if a theme is active?
- how to get path to images in the uploads folder to be used in a plugin
- How can I create a bash install script for my WordPress sites setup (WP+plugins+theme)?
- How can I have two different urls for the same page that load two different templates?
- How to enable edit button in the theme’s customize UI?
- How get list of updates of wp site?
- How can I list only sites that use a particular theme or plugin?
- Which hook callback has priority if both plugin and theme use the same hook?
- Themes VS Plugins [duplicate]
- Force wordpress to request for FTP Info on theme/plugin install/update
- Can a WordPress plugin or theme contain a virus?
- Override the core function locate_template
- WordPress site migration addvice
- add_meta_box (Will display only in specific page admin WordPress)
- WordPress 5 upgrade: until when is it safe to keep project running in 4.x?
- Installing WordPress only for a separate page – ‘mydomain.com/blog’
- ‘Customize’ button in admin bar for CSS
- Uncode theme content block header ignoring saved changes/not updating?
- Theme and plugin install or update display error in localhost
- Reduce Drop down Menu Width in WordPress
- Create custom registration form for WordPress Multisite
- Classified ad website : which solutions to use? [closed]
- posts comments goes to trash
- Advanced Custom Field DatePicker [closed]
- What will happen if i deactivate my visual composer plug in? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- Is there any hook for theme activation ? or something similar?
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- My single.php page does not show the related data to the post which is clicked
- Basic gallery plugin suggestion [closed]
- How to write “alt” tag in image for wordpress code?
- How to activate a plugin on the activation of a theme?
- WordPress plugin won’t show on some themes
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Theme My Login Shortcode Doesn’t Return Anything
- Include Minit plugin in theme [closed]
- How do I add a plugin dependency to my customized theme?
- Moving FB comments at the end of page
- How Do I Uninstall a Current WordPress Theme and Install a Fresh Theme
- What is it and from where it is loaded?
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Cannot add edit themes and add plugins after multisite update
- Load CSS files in header of Bones theme?
- How to handle a WordPress blog with articles in different languages?
- display unique post per category
- How to display a widget on a page with no theme?
- Remove updates text on plugin or themes list page
- navigation among single posts
- How to prevent plugin, theme installation failures on WordPress?
- WordPress Cache delete on plugin uninstall
- Edit all $wp_scripts at once to $in_footer = false
- Unknown theme modal source
- WordPress website will not show menu on a Mobile Device
- Ensure WordPress Theme Uninstalls Completely
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- Ajax Call not Working in Plugin
- Changing the pointing of assets from old server to new server
- Hide Plugin Custom Post Type Menu Link
- Image path in childs theme
- Hooking into the HTML header container
- Set up new WordPress domain using unclear files
- Genesis Child Theme – Customize body
- Securing langugae folder
- Unable to activate themes on localhost
- How to roll back WordPress version or prevent migration from forcing update?
- Multisite converted to Single Site can’t add new plugins or new themes
- why my wordpress dont have toolbar like, plugin, themes and other?
- how to add custom css at top above all css file for specific url
- How to Call Function From Separate WordPress Install on Same Server?
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Using activated_plugin to run code
- Theme styling for plugins
- Creating themes using the one Plugin (Toolkit)
- What is the process for reimplementing a back up WordPress?
- Notice: Use of undefined constant Redux_TEXT_DOMAIN – assumed ‘Redux_TEXT_DOMAIN’
- How to install wordpress theme’s plug-ins?
- White screen and can’t activate themes and plugins
- jquery-issue: cannot load the basic jquery
- Template from scratch: Sidebars not showing widget
- custom registration form [duplicate]
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- Activate plugins by a theme’s functions.php?
- Site is setup statically – how to make it content managable?
- do_shortcodes() isn’t working
- Javascript as Jquery Function Call?
- Any plugin/theme available which suits my requirement? [closed]
- Two sites one PC
- How to escape html code?
- Elementor with system colors instead of kit colors [closed]
- Am having issues intergrating this api into my wordpress site, any help please?
- How to add links to different language versions of WordPress
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)