resume_theme() WordPress Function
The resume_theme() function is a powerful tool that allows you to easily create a professional looking resume. This function comes with a number of great features, including the ability to easily add your own personal information, work history, education, and skills. You can also customize the look and feel of your resume by choosing from a variety of different themes.
resume_theme( string $theme, string $redirect = '' ) #
Tries to resume a single theme.
Description
If a redirect was provided and a functions.php file was found, we first ensure that functions.php file does not throw fatal errors anymore.
The way it works is by setting the redirection to the error before trying to include the file. If the theme fails, then the redirection will not be overwritten with the success message and the theme will not be resumed.
Parameters
- $theme
(string)(Required)Single theme to resume.
- $redirect
(string)(Optional) URL to redirect to.
Default value: ''
Return
(bool|WP_Error) True on success, false if $theme
was not paused, WP_Error
on failure.
Source
File: wp-admin/includes/theme.php
function resume_theme( $theme, $redirect = '' ) { list( $extension ) = explode( '/', $theme ); /* * We'll override this later if the theme could be resumed without * creating a fatal error. */ if ( ! empty( $redirect ) ) { $functions_path = ''; if ( strpos( STYLESHEETPATH, $extension ) ) { $functions_path = STYLESHEETPATH . '/functions.php'; } elseif ( strpos( TEMPLATEPATH, $extension ) ) { $functions_path = TEMPLATEPATH . '/functions.php'; } if ( ! empty( $functions_path ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'theme-resume-error_' . $theme ), $redirect ) ); // Load the theme's functions.php to test whether it throws a fatal error. ob_start(); if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { define( 'WP_SANDBOX_SCRAPING', true ); } include $functions_path; ob_clean(); } } $result = wp_paused_themes()->delete( $extension ); if ( ! $result ) { return new WP_Error( 'could_not_resume_theme', __( 'Could not resume the theme.' ) ); } return true; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |