REST-API: extend media-endpoint

I found the solution for my problem. The object type for media is not media, it’s just attachment. So the following code works for me: <?php /** * Plugin Name: REST Response Modifier * Description: A simple plugin to modify the rest api * Author: TheBalco * Author URI: http://somepage.dev */ add_action(‘rest_api_init’, ‘tb_add_custom_rest_fields’); function tb_add_custom_rest_fields() … Read more

Show different Customizer Settings on Page-Tamplates

The customizer API offers active_callback methods on both the control andd section classes. Basically you use either an conditional or a custom function to determine if a control or section is shown to the user. If you want a section to appear only for pages, you would do somthing like this: $wp_customize->add_section( ‘wpse_283821_acme_pages’, array( ‘title’ … Read more

Hide/show customizer controls based on other settings in Customizer

you can define the conditional display on definition in PHP with somethign like that : $wp_customize->add_control(“course_instructor_layout”, [ // … other arguments “settings” => “course_instructor_layout”, “active_callback” => function ($control) { return !$control->manager->get_setting(“lmscore_improved_summary”)->value(); }, ]); if that doesn’t work in your case, edit your question to add the complete definition of lmscore_improved_summary and course_instructor_layout.

Stuck with wp_remote_post sending data to an external api on user registration

I recommend only setting the arguments you absolutely need to change from defaults, to eliminate potential issues while testing. It’s best to only add additional arguments as they are needed. All arguments can be found here: https://developer.wordpress.org/reference/classes/WP_Http/request/ If possible also remove the required authentication at first to just test the POST before adding in security/authentication. … Read more

how to get nonce using json api

You need to call like below. API call:- http://78.47.177.214/blog/api/get_nonce/?json=get_nonce&controller=posts&method=create_post Responce:- {“status”:”ok”,”controller”:”posts”,”method”:”create_post”,”nonce”:”92f31d49b5″}

An Unexpected HTTP Error occurred during the API request

Use the following function to debug the HTTP API request, you will get to know the actual reason why the HTTP API request is failing. Paste the following code in your theme’s function.php. function dump_http_response( $response, $type, $transport, $args, $url ) { if ( is_admin() && $type == “response” ) { echo ‘<span style=”color: #f00;”>’; … Read more

API in numbers?

From quick run of phploc as of current stable version (4.0) there are 2662 functions in WordPress core. Structure Namespaces 0 Interfaces 1 Traits 0 Classes 241 Abstract Classes 4 (1.66%) Concrete Classes 237 (98.34%) Methods 2842 Scope Non-Static Methods 2552 (89.80%) Static Methods 290 (10.20%) Visibility Public Methods 2571 (90.46%) Non-Public Methods 271 (9.54%) … Read more