Where is getSite selector defined?

I found it – it is dynamically injected as entity in gutenberg/packages/core-data/src/index.js, on line 22 const entitySelectors = rootEntitiesConfig.reduce( ( result, entity ) => { const { kind, name } = entity; result[ getMethodName( kind, name ) ] = ( state, key, query ) => selectors.getEntityRecord( state, kind, name, key, query ); result[ getMethodName( kind, … Read more

How to use register_setting()

The function register one option or a settings group. So yes, you register the group of a section and use all fields inside this group because the group store all settings fields as array in one item. register_setting( ‘_example_plugin_settings’, ‘_example_object_settings’, array( ‘type’ => ‘object’, ‘default’ => array( ‘some_str’ => ‘A’, ‘some_int’ => 3, ), ) … Read more

Wordpres password as plain text in email

No, WordPress passwords are not stored in plain text. They’re stored as hashes generated by an old version of PHPass, which I think does multiple rounds of salted MD5 hashes. You cannot extract the original password from this, by design. See Why shouldn’t I store passwords in plain text? on Information Security StackExchange. If you … Read more

HELP: Code To Check Status And Write Debug Entry

You can get the response code with wp_remote_retrieve_response_code() and log the response with error_log(). function my_better_uptime_heartbeat() { $worked = false; $response = wp_remote_get( ‘https://betteruptime.com/api/v1/heartbeat/<heartbeat_ID>’ ); if ( ! is_wp_error( $response ) ) { if ( 200 == wp_remote_retrieve_response_code( $response ) ) { // It worked, no need to log anything. $worked = true; } } … Read more

How to block external access to register_rest_route callback?

When registering a route with register_rest_route() you can provide a permission_callback which is a function that checks whether the user has permission to use the endpoint. If only Administrator users should be able to use the endpoint then you can check for the manage_options capability in the callback, like this: register_rest_route( ‘myplugin/v1’, ‘update-rmp”, array( ‘permission_callback’ … Read more

Admin Menu for New Post

It looks like you’re trying to add a custom post type called Tutorial. WordPress handles creating the menu all on its own – all you need to do is register the post type. You can start with something like: <?php // Use the `init` hook. add_action( ‘init’, ‘wpse_412823_register_tutorials’ ); function wpse_412823_register_tutorials() { // Set up … Read more

How to get a list of pages (not posts) with specific tags?

get_pages() is a valid function, but it doesn’t have any parameters for getting pages with specific taxonomy terms assigned. WP_Query will get posts of any type (such as Pages) and can query by taxonomy terms. If you don’t want to look through your plugin’s code to find out what it calls the Page Tag taxonomy, … Read more