Title: WP_Customize_Partial::render_callback
Published: April 12, 2016
Last modified: August 20, 2026

---

# WP_Customize_Partial::render_callback( WP_Customize_Partial $partial, array $context = `array()` ): string|array|false

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#changelog)

Default callback used when invoking [WP_Customize_Control::render()](https://developer.wordpress.org/reference/classes/wp_customize_control/render/).

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#description)󠁿

Note that this method may echo the partial _or_ return the partial as a string or
array, but not both. Output buffering is performed when this is called. Subclasses
can override this with their specific logic, or they may provide an ‘render_callback’
argument to the constructor.

This method may return an HTML string for straight DOM injection, or it may return
an array for supporting Partial JS subclasses to render by applying to client-side
templating.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#parameters)󠁿

 `$partial`[WP_Customize_Partial](https://developer.wordpress.org/reference/classes/wp_customize_partial/)
required

Partial.

`$context`arrayoptional

Context.

Default:`array()`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/?output_format=md#return)󠁿

 string|array|false

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

    ```php
    public function render_callback( WP_Customize_Partial $partial, $context = array() ) {
    	unset( $partial, $context );
    	return false;
    }
    ```

[View all references](https://developer.wordpress.org/reference/file/wp-includes/customize/class-wp-customize-partial.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/customize/class-wp-customize-partial.php#L283)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/customize/class-wp-customize-partial.php#L283-L286)

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

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

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_partial%2Frender_callback%2F)
before being able to contribute a note or feedback.