An application programming interface (API) specifies how some software components should interact with each other. In addition to accessing databases or computer hardware, such as hard disk drives or video cards, an API can be used to ease the work of programming graphical user interface components. ...

learn more… | top users | synonyms

16
votes
8answers
11k views

How do you create a “virtual” page in WordPress

I'm trying to create a custom API endpoint in WordPress, and I need to redirect requests to a virtual page in the root of WordPress to an actual page that ships with my plug-in. So basically, all ...
16
votes
3answers
7k views

Programmatically add a Navigation menu and menu items

Through API functions, I want to define a new Navigation menu, select it in the current theme, and then insert a few Pages as menu items. This is to be done for instance on a theme activation. ...
12
votes
2answers
522 views

New WP_Customize API - how does it work under the hood?

I noticed that if you make changes trough the new "customize" feature, when you navigate on a different page within the iframe preview document, your changes still apply, even if they are unsaved. It ...
11
votes
2answers
4k views

Difference Between Filter and Action Hooks?

I have been looking at the plugin API a bit more in depth recently and I was wondering what real differences there were between action and filter hooks. They both are events that receive data as a ...
11
votes
3answers
479 views

Wordpress API Menu/Submenu Order

I'm developing a child-theme using Wordpress 3.4.2 and the development version of the Options Framework by David Price. This is my first theme and I'm relatively new to this, so I've had a look into ...
10
votes
2answers
2k views

How to pass variable to add_settings_section() callback?

I am attempting to automate, as much as possible, the Settings API function calls for each setting in a Plugin. Looping through the options array, and outputting add_settings_section() and ...
10
votes
2answers
4k views

Access WordPress API Outside of WordPress (command-line PHP)

I have a PHP script that I need to run as a cron job. However this script needs access to the WP API (get_pages(), get_post_meta() and get_permalink() specifically). I've followed the instructions ...
10
votes
1answer
451 views

How to create an API for my plugin?

I have been developing plugins for WordPress, most plugins I have developed use two or three classes, hence not as huge as Buddypress or WooCommerce. I am planning to develop two open source plugins ...
10
votes
2answers
224 views

Which of my blog and personal data is being transfered when Wordpress automatically checks for updates?

I'm generally concerned about privacy and I've heard that with each contact to the Wordpress API for update checks and similar a lot of my blogs data is being transfered. To get a better impression, ...
9
votes
1answer
817 views

Using the Rewrite API to Construct a RESTful URL

I'm trying to generate rewrite rules for a RESTful API. I just want to see if there is a better way to make this work than having to write out every possible rewrite combination. Ok so I have 4 ...
7
votes
1answer
290 views

How to use “Add link” pop up for a WordPress widget

In the WYSIWYG editor of WordPress you get pop up if you want to add a link for a text. Is there a possibility to access this functionality? Because I want to use this pop up for a WordPress widget ...
6
votes
1answer
2k views

Best way to programmatically remove a category/term from a post

I am working on a script to convert all posts in a given category to use a postmeta flag instead (testing of MySQL has shown me that on a site as large as mine this will lead to a meaningful decrease ...
5
votes
3answers
2k views

WP function/filter for modifying http headers?

Is there a dedicated WP function, action or filter to use when adding/modifying the HTTP headers? For now I just hook a PHP header() call into the WP 'init' hook like this: add_action('init', ...
5
votes
2answers
337 views

WordPress.org API - Get plugin authors favorite plugins

There have been some recent additions to the WordPress.org plugin repository. Most notably the changes to the plugin page and the author profile page which now shows an authors favorite plugins. I ...
5
votes
2answers
1k views

How to store username and password to API in wordpress option DB?

I'm currently developing a plugin and the chances are that I will more than likely release it on the public plugin repository so others can use it. The plugin will be using an API and to use this API ...
4
votes
2answers
1k views

What WordPress API function lists active/inactive plugins?

After seeing thousands of useful API functions in the WordPress core, I'm surprised to discover today that there ain't a function that would list the active plug-ins. I don't know you but I'm quite ...
4
votes
4answers
1k views

Does Wordpress have a “Form API”

I do most of my development in Drupal, however I am working on a Wordpress site and I need to make a form. Which got me thinking, is there a Form API for wordpress like there is Drupal? Is there a way ...
4
votes
2answers
149 views

External WordPress API

I'd like to manipulate a WordPress website from another program/website. IS there an API already written that provides access, and authentication, to do this? Ideally, I'll be using a multi-site ...
4
votes
1answer
2k views

Create API for single sign-on with 3rd party site

My site needs to integrate with a 3rd party software, which will live on its own sub-domain, hosted by the software company. I need to provide the 3rd party developers with an endpoint that they can ...
4
votes
3answers
3k views

What is the best way to get directory path for wp-config.php?

I am developer of the plugin mapsmarker.com which also offers several APIs which can be accessed directly (eg www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-geojson.php?marker=1) ...
4
votes
2answers
1k views

How to use WP_Error $data argument?

The Call $error = new WP_Error( $code, $message, $data ); The Output Say I added three messages (msg A, msg B, msg C) to the code my_code and with the last message I added "Data" as $data, which ...
3
votes
2answers
213 views

List Table API - Safe to use?

Just curious what developers think about extending the WP_List_Table class for use on plug-ins. I am working on a plug-in that will show a list of users (ID, name, email) then pull data from another ...
3
votes
2answers
731 views

Theme Options page with tabs

I have a theme that I'm developing from an HTML template I have. I'm also designing an options page along with a plethora of plugins built-into the theme itself. I've chosen a tabbed interface and I'm ...
3
votes
1answer
361 views

Authentication/API Questions

We are trying to use S2Member to manage our WP site and memberships for a Flash program that we are launching. We'd like to use S2Member to authenticate the user when they login and remain logged in. ...
3
votes
1answer
2k views

[Plugin WPML] : How to create a translation of a post using the WPML API?

I'm trying to figure out how to create a translation for a post using the internal WPML API (inc/wpml-api.php) I simply want to create a translation for post ID xx, set some content and publish it. ...
3
votes
1answer
379 views

Trying to get custom post meta through Jetpack JSON API

I'm using the Jetpack for Wordpress to produce a JSON API for my Events custom post type, which works fine: https://public-api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100 ...
2
votes
1answer
1k views

WordPress JSON output

Update: I've changed the code as following $cats = get_categories(); $output = array('categories' => array()); function collect_posts(){ $args = array( 'numberposts=' => 9999, 'category' ...
2
votes
2answers
160 views

How to override a function call in functions.php?

In functions.php of a theme makes a call to show_admin_bar(false) which hides admin bar in front end: if (!is_admin()) { wp_deregister_style( 'bp-admin-bar' ); if ( function_exists( ...
2
votes
2answers
2k views

How should I use register_setting, add_settings_section, & add_settings_field in my plugin's options page?

I'm working on a settings section for my plugin, and after reading over Wordpress's documentation which is in ROGUH DRAFT status, and also the Creating Options Pages - which is also in "transition", ...
2
votes
2answers
76 views

Use an attachment in multiple posts

I have an attachment in a post and I want to attach it to another post without detaching it from the first post, using the WP API.
2
votes
3answers
980 views

An Unexpected HTTP Error occurred during the API request

I just did a clean install of Wordpress. But I have a problem when I install or use the WordPress API. So send me a sign An Unexpected HTTP Error occurred during the API request. The strange ...
2
votes
2answers
3k views

wp_enqueue_style built in styles

I'm writing (rewriting) my plugin to use wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-dialog'); Which is great! But to use the dialog I need to load a jquery style sheet with ...
2
votes
4answers
295 views

WP.org API: Accessing plugin downloads “Today” value?

I'm developing a plugin to display stats for downloads and various other information that developers might want to display on their sites about what they have developed. I've found documentation on ...
2
votes
1answer
496 views

API integration with WordPress

I'm trying to integrate a 3rd party API with WordPress. I fear this is above my head. I was this code but I'm not exactly sure how to make is work in WordPress. Is it possible? $ch = curl_init(); ...
2
votes
2answers
672 views

get post type plural

Currently I'm trying to get the post type labels plural. In detail: $GLOBALS['wp_post_types'][ get_current_screen()->post_type ]->labels->name This is how I'm trying to retrieve it - in ...
2
votes
2answers
335 views

What is the official way to consume the Wordpress API? (api.wordpress.org)

Was wondering if anyone knows here if the API at api.wordpress.org is free to use without keys. I haven't really found any information about key registration. I'd like to use it to make a few ...
2
votes
2answers
55 views

How to check if WordPress is updating plugins?

I have a simple dependency check at the start of some plugins - which check if another plugin is installed and active (using class_exists()). This works well in the normal WordPress flow - as the ...
2
votes
1answer
673 views

Custom routing for plugins

I am making a plugin that needs a page that can be accessed from the outside, pretty much like an API, and have the url like so, http://xxxxx/custom_method?parameter=xxxxx&something=xxxx is ...
2
votes
1answer
162 views

API for Post Stats for Self-Hosted Wordpress using JetPack

EDITED for Clarification WordPress.com as well as JetPack provides stats (like no of views, referrer, etc) for various posts and blog as described here :Wordpress Stats Is there an API so that I ...
2
votes
1answer
305 views

In the new Theme Customizer API, how to send a value from the front back to the admin panel?

I'm digging a bit into the new Theme Customizer API, in particular into the javascript one, and what I find is delighting. I've managed to add my own custom parameters, and I also have the javascript ...
2
votes
1answer
186 views

wp_insert_comment error. puzzled by date value

I am trying to programmatically insert comments in a bulk operation as part of migration routine. Comments are in a SQL server table. I receive the date info from the SQL server table field and ...
2
votes
1answer
314 views

What is the best way to move a plugin´s subdirectory+files to wp-content/uploads-directory?

I am developer of the plugin Leaflet Maps Marker (http://www.mapsmarker.com - "Pin, organize & show your favorite places through OpenStreetMap, OGD Vienna or any custom WMTS-map") and have one ...
2
votes
1answer
132 views

Connect external web app to wordpress

We have a web app that will allow users to edit their videos; and add intros, outros, and watermarks. Once the user already done on their video. We need to provide an option to post or syndicate ...
2
votes
0answers
514 views

Wordpress JSON API Extend to Create Users [closed]

I have the JSON API Plugin installed on my wordpress blog and it works like a charm. However there is one functionality that i really need. A method called create_user which should take parameters ...
2
votes
3answers
1k views

How do I create a widget that only allows a single instance?

How do I create a widget that only allows a single instance of a widget to be added through the Wordpress interface? The default behaviour of widgets allows multiple instances to be added. I am ...
1
vote
4answers
7k views

How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?

I'm building a plugin and I want to add bits of javascript in the admin head but only for certain admin pages. I don't mean pages as in a WordPress page that you create yourself but rather existing ...
1
vote
2answers
977 views

wp_localize_script escaping my url - fix or alternative

Here is my wp_enqueue_script and wp_localize_script - which i am using to run an Ajax call. wp_enqueue_script( 'function', plugin_dir_url( __FILE__ ) . 'function.js', array( 'jquery', 'json2' ) ); ...
1
vote
3answers
228 views

Does WordPress's HTTP API use any caching?

I'm working on a plugin to will retrieve data from a remote server and display it on the Dashboard. To do this, I'll be using the WordPress HTTP API but I'm not seeing any information on the HTTP API ...
1
vote
2answers
639 views

Creating external apps Wordpress / How they work

I was wondering how does external app works for wordpress.com or wordpress.org. Directly connecting to the wordpress database seems a bad idea to me. Questions How can I create an app or get / ...
1
vote
1answer
257 views

How Can I Use $wpdb in PayPal IPN file?

I'm currently writing a plugin that requires the PayPal IPN, since the IPN is not inside the main plugin file, I have no way to use $wpdb. If you know a way to do this that will work with all ...