: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Block Bindings API: WP_Block_Bindings_Source class.
* @subpackage Block Bindings
* Class representing block bindings source.
* This class is designed for internal use by the Block Bindings registry.
* @see WP_Block_Bindings_Registry
final class WP_Block_Bindings_Source {
* The name of the source.
* The label of the source.
* The function used to get the value from the source.
private $get_value_callback;
* The context added to the blocks needed by the source.
public $uses_context = null;
* Do not use this constructor directly. Instead, use the
* `WP_Block_Bindings_Registry::register` method or the `register_block_bindings_source` function.
* @param string $name The name of the source.
* @param array $source_properties The properties of the source.
public function __construct( string $name, array $source_properties ) {
foreach ( $source_properties as $property_name => $property_value ) {
$this->$property_name = $property_value;
* Retrieves the value from the source.
* @param array $source_args Array containing source arguments used to look up the override value, i.e. {"key": "foo"}.
* @param WP_Block $block_instance The block instance.
* @param string $attribute_name The name of the target attribute.
* @return mixed The value of the source.
public function get_value( array $source_args, $block_instance, string $attribute_name ) {
return call_user_func_array( $this->get_value_callback, array( $source_args, $block_instance, $attribute_name ) );
public function __wakeup() {
throw new \LogicException( __CLASS__ . ' should never be unserialized' );