How to get a post’s associated taxonomies and terms in wp api v2

Ok, I just stumbled upon the answer buried deep in the github issues page: https://github.com/WP-API/WP-API/issues/1403 The answer is: the reason is that the terms / meta etc are different objects, and in typical REST design going a GET on a single resource, will give you that resource, not that resource and a bunch of other … Read more

Problem with Settings API: changes are not saved after submit

You need to register the proper settings fields in your PPAdminOptions() and also point the form action to options.php: function PPAdminOptions() { if ( !current_user_can( ‘manage_options’ ) ) { wp_die( __( ‘You do not have sufficient permissions to access this page.’ ) ); } ?> <div class=”wrap”> <h1><?php echo get_admin_page_title(); ?></h1> <form method=”post” action=”options.php”> <?php … Read more

Validate rest-api call on create

As I said in the comments, since it’s a custom endpoint, you could just cancel the post creation via the main callback, i.e. something like so: ‘callback’ => function () { if ( some condition ) { // create the post } else { // return existing post or something else } } And here’s … Read more

WordPress stats API key

This is why: http://plugins.trac.wordpress.org/browser/stats/tags/1.7.2/stats.php#L685 The deactivation hook deletes your database information. I’m guessing you’re manually deactivating the plugin, updating, and then re-activating? If so, that runs the deactivation hook. Fortunately, that’s not from the latest version. This is: http://plugins.trac.wordpress.org/browser/stats/tags/1.7.3/stats.php#L686 So that shouldn’t happen anymore. By the way, you shouldn’t think that this means you were … Read more

Use WP admin AJAX url to hide API key

I would break this problem in to 2 parts. First, you could sent an Ajax request to your server, sending only the dataString variable. Then, you can use either cURL or wp_remote_get() on the server to access the real API. This could be the only solution, if you want to avoid playing hide and seek … Read more

How to send messages when a customer is registered

If you’re talking about WordPress user registration, you want to start by reading about the User Register hook: https://codex.wordpress.org/Plugin_API/Action_Reference/user_register Then your code would be something like this which will automatically fire each time a user registers on the site: add_action(‘user_register’,’send_sms’); function send_sms($user_id){ // Code for your SMS API Here } The code would go in … Read more

How to query WordPress from another application?

different solutions use the rss or atom-feed (each is xml) and parse it; has always fast and sure the post and data inside; easy to use with different langugage, all frameworks has implement for parse xml. use the xmlrpc interface; but is optional in WP and you must read the documentation for the API scan … Read more