SOLUTION: after_switch_theme
does exactly what I intended here. It fires after the theme is switched TO your theme. One of the solutions mentioned below uses switch_theme
. This does not have the desired results, since it only happens upon switching away from your theme.
Here is an article that I found as reference: http://core.trac.wordpress.org/ticket/7795#comment:29
Here is my modified code
add_action( 'after_switch_theme', 'fwp_theme_setup' );
function fwp_theme_setup(){
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-admin/includes/plugin.php');
activate_plugin('enable-media-replace/enable-media-replace.php');
activate_plugin('seo-image/seo-friendly-images.php');
activate_plugin('w3-total-cache/w3-total-cache.php');
}
Related Posts:
- get_template_part vs action hooks in themes
- Never actually adding the action? Or do I have to call the action?
- How to make a function occurs for one time?
- How to add custom css file in theme?
- Do I actually need to link my theme’s style.css in the theme files
- CSS classes for theme
- Should `get_template_directory_uri()` be escaped?
- My child theme doesn’t work Error: “The parent theme is missing. Please install your parent theme”
- How To Add New Option Types To Option Tree?
- Theme file for all pages that are a child of a specific page
- Child Theme not loading parent CSS
- Where do I find the functions triggered within a hook?
- How to show next Post Thumbnail image in WordPress using current post id
- First post of each category
- index.php is not loaded for single posts
- WordPress website loads but is not displayed until page scrolled
- Create a theme by combining a parent and a child theme
- Theme Customizer not loading
- How to add oEmbed support to my theme?
- Is it a good idea to make whole theme widgetized?
- How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?
- Where is definied the theme location for the main menu in a WordPress template?
- If I build a custom theme, will it update?
- Recommended tools for Theme Development with SASS [closed]
- What tags should be used for themes to show the type of layout?
- How to disable automatic colors in the Twenty Twenty theme?
- What are non-printable characters doing in my theme?
- Gutenberg – editor-font-sizes in functions not working
- Customize the previous_post_link output
- How to use get_template_part instead of include_once?
- How to remove comment link title attribute?
- How can I let templates choose which stylesheets are enqueued?
- wp-cli: For development, how can I activate a theme that is on the local disk but not zipped?
- Lightweight framework [closed]
- Can’t login unless twentyfifteen theme is active
- Single Page Design, Storing in Theme Options
- How to edit my theme for full width?
- loading blank white screen of slide
- Child Theme’s style.css not loading in mobile browser
- Echo all category names, apart from one
- How to Find the Page the Front Page is Using?
- Customizer – loading settings/controls/sections/panels based on a id/page id
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- Overrite parent functions using child functions
- Does code in function.php differ from theme to theme
- 3 Level Deep Navigation Menu Not Showing All Levels
- save_post action doesn’t passing post id to my function as argument
- How can I change the theme of different posts using a plugin?
- Theme not showing up
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- Overide enqueue in non plugable function via child theme
- Change image size depending on page
- WordPress page/blog incorporated into static website
- Random white space before doctype
- How to add menù section to my WordPress template?
- Starting point for custom Themes [closed]
- Theme Development -> Specific Homepage
- Why still output /wp-content/themes/twentynineteen?
- get_header action not working
- Unable to change the priority with ‘remove_action’ and ‘add_action’ in child theme
- How add built-in textarea in theme development?
- Remove h1 from 2015 theme
- WordPress pulling in random page themes
- Some doubts about WordPress handle the horizontal main menu visualization
- Add content after get_header
- Can’t change theme name
- How to remove permalinks links presents in each page of my site?
- Is there a way to serve different resolution images to different devices?
- How do I restructure the comment HTML layout?
- Trying to link to a php template file but its blank
- Theme author.php transfer
- Theme: dropdown hover menu not showing up in IE/Edge
- Problem with pagination link (error 404)
- how to ensure responsiveness in wp themes? [closed]
- home is not working in wordpreess
- Is there a way to create sections under “Colors” panel in the Theme Customizer?
- Local theme changes upload on server but theme changes not showing
- WordPress Custom font not found
- WordPress uploads do not show up and I see the white screen of death in some cases
- Any way to permanently translate themes?
- New created Theme leads to malfunctioning Xampp Apache –> functions.php is cause
- WordPress Blog Page displaying nothing
- Primary Menu Showing All Pages With No Sub-Nav
- Magnific Popup – Add Caption to Images
- Why do WordPress developers use so many opening and closing PHP tags when developing themes? [duplicate]
- Safe way to echo wp_trim_words
- Theme Development : License help
- How can I demonstrate themes well?
- Suppress the_content filter in a nested loop
- How to update my own theme?
- WordPress custom jquery not found
- Custom link color or stylesheets
- Showcase your wordpress themes [closed]
- How to remove proudly created by WordPress in theme?
- Roll my own theme or customize an existing one [closed]
- Why do some sites show themes/”themename” as the only theme?
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
- My wordpress site memory exhausted more than 1GB trying to debug with default
- Full site editing templates folder vs block-templates