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

18
votes
8answers
15k 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 ...
17
votes
3answers
10k 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. ...
16
votes
2answers
7k 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 ...
12
votes
2answers
577 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
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 ...
11
votes
1answer
561 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 ...
11
votes
3answers
616 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
3answers
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
2answers
275 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
1k 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 ...
8
votes
2answers
2k 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 ...
7
votes
1answer
814 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
4answers
755 views

Is there a JavaScript API? How to access public and private data in JS?

According to this post there is no built-in JavaScript API for Wordpress. Therefore developers who want to build on AJAX seem to come up all with their own solution which doesn't seem right to me. ...
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
2answers
290 views

Passing a hardcoded page/post ID into `get_post`

I see people using this to pull in page content on their home pages, remove specific categories from archives etc.. e.g. $post = get_post( 5 ); Someone suggested this was bad practice. Why is it ...
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
4answers
2k 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 ...
5
votes
1answer
4k 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 ...
5
votes
2answers
444 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 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 ...
5
votes
1answer
3k 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. ...
4
votes
2answers
2k 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
2answers
188 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
3answers
5k 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
0answers
26 views

Override Wordpress user with Oauth2 account

My first time here, so I hope this question is in the appropriate place. I am trying to setup Wordpress as an OAuth2 client. All of our users are stored in our proprietary CMS which is an OAuth ...
3
votes
1answer
2k 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' ...
3
votes
2answers
359 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.
3
votes
2answers
246 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
907 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
2answers
1k views

Trying to get custom post meta through Jetpack JSON API [closed]

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 ...
3
votes
1answer
400 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
0answers
110 views

Is it Possible to Extend WP Customize JS Methods?

I’m wondering if it’s possible to extend the methods of the anonymous api object in wp-admin/js/customize-control.js. I need to overwrite one of these methods with my own custom logic but I suspect ...
3
votes
1answer
70 views

Ask user permission when activating a plugin

Is there a specific Wordpress API way to ask the user's permission for something when activating a plugin? Due to the Wordpress plugin directory policy I have to ask the users consent for the ...
2
votes
4answers
11k 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 ...
2
votes
4answers
483 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
2answers
186 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
3answers
916 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
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
1answer
41 views

API in numbers?

does anyone knows how many functions Wordpress has? I mean, are the more used functions around 100 or more than 200? ps: I am trying to build a catalog of the API and wrap it behind a visual ...
2
votes
3answers
1k 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
1answer
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
1answer
989 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
355 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
63 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
737 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
585 views

Custom Connect to Facebook, problem logging in/logging out

I am working on a custom function for login in my users via facebook. I started by reading this nice tutorial on how to login in via facebook: ...
2
votes
1answer
385 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
228 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
384 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
75 views

Send Data to Wordpress from kiosk

I need to get a data from kiosk (think specific ATM machine) to wordpress database. Kiosk service providers told me to give them Gateway URL and Request format to send data. Im stuck on this, I dont ...