is_plugin_active() is rather fragile: it will break when either the plugin author renames the main file or when the user renames the plugin’s directory or main file. It’s better to check if a certain public function exists.
To avoid having to make that check each time you need some of the plugin’s functionality, you could show a message in the admin area:
add_action( 'admin_notices', 'my_theme_dependencies' );
function my_theme_dependencies() {
if( ! function_exists('plugin_function') )
echo '<div class="error"><p>' . __( 'Warning: The theme needs Plugin X to function', 'my-theme' ) . '</p></div>';
}
Another alternative is to use something like http://tgmpluginactivation.com/
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Is there any sort of theme dependency management?
- How do I cleanly override a plugin’s CSS with a child theme?
- Is it possible to stop selected plugins from loading on certain template pages?
- Hide wordpress plugins from list
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Function to activate WordPress theme inside a plugin
- Seeking clarification on page request life-cycle
- Which functions in theme or plugin load first
- Get info (url) from already enqueued styles
- resize only height using wp_get_image_editor
- Autoload via composer in plugin interference
- Is there a quick way to inject i18n domain into theme/plugin files?
- WordPress language switcher
- Showing Co-Authors on post page
- WP theme with Backbone
- Translating plugin inside the theme [closed]
- Editing Theme to apply Co-Authors Plus
- Include Max mega menu Plugin into theme
- How to integrate plugin in WordPress theme
- How to include plugin without activation?
- How do you remove plugin edit option?
- WordPress logo upload option in theme panel
- Custom Taxonomy Tag Search
- wordpress theme backend admin only
- Check if we’re viewing an event
- Menus, but not by theme location
- how to load the language file in plugin?
- How to get current post user id
- Events Made Easy Plugin – Duplicate Title Tags
- Different UI in WordPress
- What is the correct way to update both WP/plugins/themes without breaking the site?
- Redux Framework has an embedded demo. Click here to activate the sample config file
- The problem with WordPress Importer
- Why does my functions.php cause white-screen and media-library issues?
- how to give a user a role?
- Display post lists in 2nd paragraph
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Plugin can not display in my custom theme
- How to use get_template part in the plugin?
- WordPress premium theme development [duplicate]
- How do I combine a theme with a plugin
- how to force tag page layout to use same as search layout?
- How can I show a different theme for admin users? WP 3.8+
- How to show the number of website visitors in my theme
- How to write “alt” tag in image for wordpress code?
- How to multiply a post to test internal search results?
- Use different single.php file based on condition
- What form should the $query media query array have for an Elementor page builder function? [closed]
- is_rtl returns false while it should return true
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Widget for specific category
- How to customize this theme? [closed]
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- Remember the Meta Value With Radio Buttons
- WordPress plugin with its own “site”/theme
- Theme Functions run a function upon activation or preview
- Polldaddy doesn’t show up on own theme
- How to add an admin alert for missing plugins
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Janrain/Simple Modal under Redirected Domain
- Warning: Attempt to read property “ID” on null in C:\xampp\htdocs\Nnamdi1\wp-content\plugins\elementor\core\base\document.php on line 250 [closed]
- Excluding specific post from custom next/previous theme function
- Seperate plugin and theme files
- Elementor Sidebar not loading when PRO elements plugin is active
- How would I get the new plugin version on this function?
- Unpublished Pages Failing To Appear On Custom Path
- How to get checkbox by default true in metabox?
- Conditionally load public and admin code with AJAX working on both sides
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- When the user entered an unauthorized url redirect to login page
- Remove action added in plugin class from theme
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- Show content from plugin on index
- Get plugin to background of page
- How to add wordpress plugins in along with my standalone theme
- Directory structure for plugin changes
- How to show post attachment image
- How can I add different menus (different style menu) on each page?
- Site is setup statically – how to make it content managable?
- How to generate a responsive output from plugin?
- How to work email subscribe in WordPress?
- How to create post comparison in wordpress
- Open graph issue on my theme
- Javascript as Jquery Function Call?
- Editing a theme
- Can anyone tell some online tuts for plugin development for beginner? [closed]
- How to escape html code?
- Ajax button “Load more” is not loading correct language version posts for logged out users
- How to code a wordpress page properly? Dashboard or unique Theme files or alternative?
- how to make wordpress remember my choice
- Meta box not displaying on the plugin page
- Getting error when accessing Customizer Page
- Frontend Enqueued Files in the Backend
- How to create new title and its description inside a section in WP Customizer?
- I want to move the one click accesbility button on bottom of my website screen,
- Automatically install bundled plugins during theme activation?