Title: WP_Customize_Manager::after_setup_theme
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Customize_Manager::after_setup_theme()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#wp--skip-link--target)

Callback to validate a theme once it is loaded

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#source)󠁿

    ```php
    public function after_setup_theme() {
    	$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
    	if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
    		wp_redirect( 'themes.php?broken=true' );
    		exit;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-customize-manager.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-customize-manager.php#L665)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-customize-manager.php#L665-L671)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Customize_Manager::doing_ajax()](https://developer.wordpress.org/reference/classes/wp_customize_manager/doing_ajax/)`wp-includes/class-wp-customize-manager.php` |

Returns true if it’s an Ajax request.

  | 
| [validate_current_theme()](https://developer.wordpress.org/reference/functions/validate_current_theme/)`wp-includes/theme.php` |

Checks that the active theme has the required files.

  | 
| [wp_redirect()](https://developer.wordpress.org/reference/functions/wp_redirect/)`wp-includes/pluggable.php` |

Redirects to another page.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/after_setup_theme/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_manager%2Fafter_setup_theme%2F)
before being able to contribute a note or feedback.