title: WordPress: Hook for when a theme update was installed
body: <p>My theme creates a css file when the theme settings are being update by the user. This works without an issue.</p>
  
  <p>Now I also need to create the css file, when the theme is being updated from within the dashboard or when an automatic update occurs.</p>
  
  <p>I have looked into <code>upgrader_process_complete</code> and <code>upgrader_post_install</code> based on these examples: <a href="https://codex.wordpress.org/Plugin_API/Action_Reference/upgrader_process_complete" rel="nofollow noreferrer">https://codex.wordpress.org/Plugin_API/Action_Reference/upgrader_process_complete</a> and <a href="https://wordpress.stackexchange.com/questions/215063/limit-filter-upgrader-post-install-to-a-single-plugin">https://wordpress.stackexchange.com/questions/215063/limit-filter-upgrader-post-install-to-a-single-plugin</a> but for some reason, my function is not being fired after I update the theme.</p>
  
  <p>The following code is in my functions.php of my theme.</p>
  
  <pre><code>function create_css_file() {
     //code to create css file
  }
  
  function my_upgrade_function( $options ) {
      create_css_file();
  }
  add_action( 'upgrader_process_complete', my_upgrade_function, 10, 2);
  
  //I also tried this. No luck
  add_filter( 'upgrader_post_install', my_upgrade_function, 100, 0 );
  </code></pre>
  
  <p>Am I missing something fundamental?</p>
  
  <p><strong>Update #1:</strong>
  I have lowered the priority by using <code>add_action( 'upgrader_process_complete', my_upgrade_function, 150);</code> 
  Now it seems to work, but when the <code>create_css_file</code> function is called, it uses the previous version, and not the newly installed version. When I check the CSS file that was created, it's being newly generated, but based on the old version. Not sure why this happens.</p>
  
  <p>I also change it to <code>add_action( 'upgrader_process_complete', my_upgrade_function, 1);</code> - Same issue. The old code is being used, rather than the newly installed one.</p>
  
  <p><strong>Update #2:</strong>
  Okay, I came to the conclusion, that both, <code>upgrader_process_complete</code> and <code>upgrader_post_install</code>, are being fired while the old theme is still installed, which kind of defeats the entire purpose.</p>
  
  <p>I quickly ran a test, where I removed the entire <code>upgrader_process_complete</code> section, and uploaded it to my private repository. I then went to the theme and updated it in the dashboard, but the <code>upgrader_process_complete</code> was still fired, again creating a css file based on the theme that was installed, rather than the newly installed one. But as I said, I actually removed the entire <code>upgrader_process_complete</code> code section, so it should not have fired in the first place.</p>
  
  <p>This leads me to believe, that <code>upgrader_process_complete</code> is being fired while the old theme is still installed.</p>
  
  <p><strong>Which brings me back to square one. How do I call a function, after a theme update has been successfully installed?</strong></p>