Easiest way to call an External rest API?

Mark is right, without knowing more, this is a hard question to answer. This is a general guide though (not written by me) that I’ve used for my projects in the past. https://yoast.com/wordpress-http-api/ It should get you started and then if you have other questions, please let us know.

WordPress api call using wp-ajax returns error 400

I figured this out after a night sleep. Sometimes our brains function like that. The problem was actually my call here, It should’ve been “add_foo” not “_add_foo” data: { // the value of data.action is the part AFTER ‘wp_ajax_’ in // the add_action (‘wp_ajax_xxx’, ‘yyy’) in the PHP above action: ‘_add_foo’ // ANY other properties … Read more

What to hook into to check a value before a post is published?

Try function wpse46583_save($post_id,$post) { // verify this is not an auto save routine. if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; //You should check nonces and permissions here if ( !current_user_can( ‘edit_page’, $post_id ) return; //Get category slugs associated with post $cats =get_the_category($post_id); if(empty($cats)){ //No category assigned – do something here. } return; } add_action(‘save_post’,’wpse46583_save’,10,2);

API for wp menu hacks

There are several of plugins that ads that kind of functionality. They put a checkbox to the admin area, so if you uncheck it its not gonna appear in the menu. Here is a good one: http://wordpress.org/extend/plugins/exclude-pages/

Exposing data using a custom WordPress API

You need a die(); before the closing } of the function and you might want to add the relevant php header to tell the browser it’s content-type I wouldn’t worry about the browser returning the wrong content type. As long as your code loading the data treats it as JSON So for your function try … Read more