Title: Hook before start
Last modified: January 26, 2024

---

# Hook before start

 *  Resolved [rahulapc](https://wordpress.org/support/users/rahulapc/)
 * (@rahulapc)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/hook-before-start/)
 * Hey,
   First of all, thanks for the plugin, it’s pretty awesome.We already have
   the PRO subscription, but opening a support here could be helpful to others as
   well.In our website, we do have some option that needs to be changed before simply
   static export, and after too.
 * For the AFTER action, we’re able to use some function into ‘ss_after_cleanup’
   action as suggested in your snippets and worked fine. Using this will ignore 
   the action made by plugin, the native one? “delete_option( ‘simply-static-use-
   build’ );”
   Should we include this option deletion in our custom function too?
 * But the main question is: Does exist any hook/filter to use custom function BEFORE
   simply static instance/generator is started?
 * We just need to update an option before the whole thing starts, and tried to 
   hook in first “ss_static_pages”, but seems that we got couple errors.
 * Many thanks in advance, and feel free to ask anything.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [patrickposner](https://wordpress.org/support/users/patrickposner/)
 * (@patrickposner)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/hook-before-start/#post-17376220)
 * Hey [@rahulapc](https://wordpress.org/support/users/rahulapc/),
 * I’m happy to help!
 * First off, an action that runs before the static export:
 * You have a couple of options within Simply Static, but probably the best is this
   hook:
 *     ```wp-block-code
       add_action('ss_archive_creation_job_before_start', function( $blog_id, $archive_job ) {
       	//do something.
       });
       ```
   
 * This one is executed before the job is scheduled as a background process and,
   thus, the perfect point in time to set up or save an option.
 * Action after: I would use the exact same hook for that, so
 *     ```wp-block-code
       ss_after_cleanup
       ```
   
 * is the way to go because it gets executed, no matter which deployment option 
   you choose.
 * **simply-static-use-build and simply-static-use-single**
 * These are native options outside the general “simply-static” option and are implemented
   that way to avoid being cached.
 * We could use transients for that (We did that in the past), but we ran into a
   couple of problems when Redis was used, so we implemented our own clearing mechanism.
 * I would suggest deleting these in your own implementation if you use “Builds”
   or “Single” exports in any way.
 * If we look into the implementation within Simply Static Pro, you’ll see that 
   these options get deleted in the same hook (ss_after_cleanup), so replicating
   that in your own script is recommended 🙂
 * Cheers,
   Patrick
 *  Thread Starter [rahulapc](https://wordpress.org/support/users/rahulapc/)
 * (@rahulapc)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/hook-before-start/#post-17381010)
 * Excellent, Patrick. Thank you for the prompt response, understood, and that’s
   exactly what I needed.
 * I’ll use the hook that starts before as suggested, and continue using ss_after_cleanup
   that executes afterwards.
 * Thanks, and have a great week!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hook before start’ is closed to new replies.

 * ![](https://ps.w.org/simply-static/assets/icon-256x256.png?rev=2443263)
 * [Simply Static - The Static Site Generator](https://wordpress.org/plugins/simply-static/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simply-static/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simply-static/)
 * [Active Topics](https://wordpress.org/support/plugin/simply-static/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simply-static/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simply-static/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [Static site](https://wordpress.org/support/topic-tag/static-site/)

 * 2 replies
 * 2 participants
 * Last reply from: [rahulapc](https://wordpress.org/support/users/rahulapc/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/hook-before-start/#post-17381010)
 * Status: resolved