View WordPress-SHORTINIT-Example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('SHORTINIT', true); | |
require 'wp-load.php'; | |
global $wpdb; | |
$post_id_to_get = 2; | |
$result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id_to_get ) ); | |
echo json_encode( $result ); | |
die(); |
View Modify the rendered output of any block.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modify the rendered output of any block. | |
* | |
* @param string $block_content The normal block HTML that would be sent to the screen. | |
* @param array $block An array of data about the block, and the way the user configured it. | |
*/ | |
function my_custom_render( $block_content, $block ) { |
View custom-block-editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReactDOM from "react-dom"; | |
import { | |
BlockEditorProvider, | |
BlockList, | |
WritingFlow, | |
ObserveTyping, | |
BlockEditorKeyboardShortcuts, | |
storeConfig as blockEditorStoreConfig, | |
BlockInspector, |