wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_assign_new_template_to_theme › WordPress Function

Sincen/a
Deprecatedn/a
wp_assign_new_template_to_theme ( $changes, $request )
Defined at:
Codex:

No description yet.



Source

function wp_assign_new_template_to_theme( $changes, $request ) {
	// Do not run this for templates created through the old enpoint.
	$template = $request['id'] ? get_block_template( $request['id'], 'wp_template' ) : null;
	if ( $template ) {
		return $changes;
	}
	if ( ! isset( $changes->tax_input ) ) {
		$changes->tax_input = array();
	}
	$changes->tax_input['wp_theme'] = isset( $request['theme'] ) ? $request['theme'] : get_stylesheet();
	// All new templates saved will receive meta so we can distinguish between
	// templates created the old way as edits and templates created the new way.
	if ( ! isset( $changes->meta_input ) ) {
		$changes->meta_input = array();
	}
	$changes->meta_input['is_inactive_by_default'] = true;
	return $changes;
}