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:
- Can I make plugins required?
- Automatically install wordpress plugin at theme activation
- When coding a WordPress theme, where does the theme (i.e. the presentation) end and the plugin (i.e. the functionality) begin?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- WordPress tips for speed and performance [closed]
- How to access options of Redux framework in front end
- Update Multiple Post Meta for the Same Post In One call?
- Integrating plugins in themes
- How to hide fields from my user profiles
- How to make my plugin theme-independent?
- How to load a new template page according to a particular URL?
- Translate third party plugin and save translation files in custom theme
- Add custom buttons with custom actions in Edit Post screen in WordPress?
- Code in theme functions.php faster than with a plugin?
- How do I future proof my older WordPress theme?
- Workflow and best practice for documentation [closed]
- register_theme_directory somehow “fails” when folder is outside of WP-Folder
- Display future posts?
- How to retrieve custom meta term of category taxonomy from WP Rest API?
- How does WP handle multiple matching rewrite rules?
- How to use get_theme_mod in gutenberg editor wordpress?
- Not getting author rank when using return
- How to Display a Plugin function (content) on frontpage using index.php
- How to make a slideshow shortcode based on the WordPress gallery shortcode? [closed]
- All of my custom posttypes are 404’ing
- Classified ad website : which solutions to use? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- Js file is not adding using this code in functions.php
- Redirect to another page using contact form 7? [closed]
- do add_action on condition
- multiple language website navigation menu suggestion
- Customizing Titles on the Fly with Code
- Add SideBar/Widgets Just Below the Post
- Add filter on html tags,attributes on specific function in wordpress
- plugins not working in custom theme
- Release the plugin in the WordPress repository where redux is used
- How to use the CSS of the WordPress core in the development of my administration page?
- What is the purpose of a companion plugin
- Managing wordpress Themes & plugins for multisite
- why need theme,if page builder is there in wordpress [closed]
- Add user meta after a user has registered and logged In [closed]
- Visual Composer: Where do I find the source code of a custom element?
- Changing the Organize Series Listing Pages
- What’s the right way to implement functions in footer.php
- How do you create a re-useable HTML fragment in wordpress
- Identify current wordpress theme
- Update WordPress Theme System
- Removing the custom_image_header from wp_head
- Strange Behavior on New Theme Points to Idiocy
- Code for unique user visit count on every page WordPress
- How to get authors who have added the post in the specific custom post type
- woocommerce remove coupon link does not work
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Widgets are not displaying in the admin panel
- How to override any plugin file in the child theme
- submit two file input fields in the same form
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- woocommerce: Customize email with item total count
- Child theme modifications not showing up
- Submitting form to PHP
- how to change a static testimonials into dynamic
- Rename a folder via HTML POST request
- My wordpress local urls is still displayed even moved to live
- How to get a post views count using ‘WordPress popular posts’ plugin
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Showing different js file for different theme in wordpress customizer api
- Change Jobs for WordPress templates
- How to use plugin’s shortcode in custom design? [closed]
- WordPress panel is not loading after plugin activated with error: HTTP ERROR 500
- How to wrap image tag into div for post only?
- Product catalogue in WordPress
- Add section (add_settings_section) to a custom page (add_submenu_page) not working
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- Is it possible to restrict content in wordpress?
- Display Powerpress media url
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- Showing ads in the specific category and its sub-categories
- Plugin’s required JS not being inserted in my theme
- How to copy data from user profile page (profile.php) to theme customizer
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- conditional tags for the output of a plugin
- What is the Object for WP_Error Class?
- Breadcrumb is not generating the correct post page url
- How to add a filter conditionally based on page related Conditional Tags
- Replace all media (images)
- WooCommerce custom query and paging: Not Found error
- How to add image for custom taxonomy
- Integrating WordPress Content into a jQuery Slider
- How can I convert a complete bootstrap template into a WordPress template? [closed]
- Custom GD Star Ratings Stars [closed]
- Email Masking in widget
- 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
- I want to include My theme file (testing.php) to inside my plugin folder (myplugin/mypugin.php)
- How to Enfroce Domain Licensing Limits? [closed]
- Override plugin constant using a theme
- Meta box not displaying on the plugin page
- Getting error when accessing Customizer Page