Make WordPress Core


Ignore:
Timestamp:
10/20/2016 02:54:12 AM (9 years ago)
Author:
rachelbaker
Message:

REST API: Introduce the Content API endpoints.

REST API endpoints for your WordPress content. These endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, allowing new and innovative apps for interacting with your site. These endpoints support all of the following:

  • Posts: Read and write access to all post data, for all types of post-based data, including pages and media.
  • Comments: Read and write access to all comment data. This includes pingbacks and trackbacks.
  • Terms: Read and write access to all term data.
  • Users: Read and write access to all user data. This includes public access to some data for post authors.
  • Meta: Read and write access to metadata for posts, comments, terms, and users, on an opt-in basis from plugins.
  • Settings: Read and write access to settings, on an opt-in basis from plugins and core. This enables API management of key site content values that are technically stored in options, such as site title and byline.

Love your REST API, WordPress! The infrastructure says, "Let's do lunch!" but the content API endpoints say, "You're paying!"

Props rmccue, rachelbaker, danielbachhuber, joehoyle, adamsilverstein, afurculita, ahmadawais, airesvsg, alisspers, antisilent, apokalyptik, artoliukkonen, attitude, boonebgorges, bradyvercher, brianhogg, caseypatrickdriscoll, chopinbach, chredd, christianesperar, chrisvanpatten, claudiolabarbera, claudiosmweb, cmmarslender, codebykat, coderkevin, codfish, codonnell822, daggerhart, danielpunkass, davidbhayes, delphinus, desrosj, dimadin, dotancohen, DrewAPicture, Dudo1985, duncanjbrown, eherman24, eivhyl, eliorivero, elyobo, en-alis, ericandrewlewis, ericpedia, evansobkowicz, fjarrett, frozzare, georgestephanis, greatislander, guavaworks, hideokamoto, hkdobrev, hubdotcom, hurtige, iandunn, ircrash, ironpaperweight, iseulde, Japh, jaredcobb, JDGrimes, jdolan, jdoubleu, jeremyfelt, jimt, jjeaton, jmusal, jnylen0, johanmynhardt, johnbillion, jonathanbardo, jorbin, joshkadis, JPry, jshreve, jtsternberg, JustinSainton, kacperszurek, kadamwhite, kalenjohnson, kellbot, kjbenk, kokarn, krogsgard, kuchenundkakao, kuldipem, kwight, lgedeon, lukepettway, mantismamita, markoheijnen, matrixik, mattheu, mauteri, maxcutler, mayukojpn, michael-arestad, miyauchi, mjbanks, modemlooper, mrbobbybryant, NateWr, nathanrice, netweb, NikV, nullvariable, oskosk, oso96_2000, oxymoron, pcfreak30, pento, peterwilsoncc, Pezzab, phh, pippinsplugins, pjgalbraith, pkevan, pollyplummer, pushred, quasel, QWp6t, schlessera, schrapel, Shelob9, shprink, simonlampen, Soean, solal, tapsboy, tfrommen, tharsheblows, thenbrent, tierra, tlovett1, tnegri, tobych, Toddses, toro_unit, traversal, vanillalounge, vishalkakadiya, wanecek, web2style, webbgaraget, websupporter, westonruter, whyisjake, wonderboymusic, wpsmith, xknown, zyphonic.
Fixes #38373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r38818 r38832  
    17091709
    17101710/**
     1711 * Register default settings available in WordPress.
     1712 *
     1713 * The settings registered here are primarily useful for the REST API, so this
     1714 * does not encompass all settings available in WordPress.
     1715 *
     1716 * @since 4.7.0
     1717 */
     1718function register_initial_settings() {
     1719    register_setting( 'general', 'blogname', array(
     1720        'show_in_rest' => array(
     1721            'name' => 'title',
     1722        ),
     1723        'type'         => 'string',
     1724        'description'  => __( 'Site title.' ),
     1725    ) );
     1726
     1727    register_setting( 'general', 'blogdescription', array(
     1728        'show_in_rest' => array(
     1729            'name' => 'description',
     1730        ),
     1731        'type'         => 'string',
     1732        'description'  => __( 'Site description.' ),
     1733    ) );
     1734
     1735    register_setting( 'general', 'siteurl', array(
     1736        'show_in_rest' => array(
     1737            'name'    => 'url',
     1738            'schema'  => array(
     1739                'format' => 'uri',
     1740            ),
     1741        ),
     1742        'type'         => 'string',
     1743        'description'  => __( 'Site URL.' ),
     1744    ) );
     1745
     1746    register_setting( 'general', 'admin_email', array(
     1747        'show_in_rest' => array(
     1748            'name'    => 'email',
     1749            'schema'  => array(
     1750                'format' => 'email',
     1751            ),
     1752        ),
     1753        'type'         => 'string',
     1754        'description'  => __( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. The new address will not become active until confirmed.' ),
     1755    ) );
     1756
     1757    register_setting( 'general', 'timezone_string', array(
     1758        'show_in_rest' => array(
     1759            'name' => 'timezone',
     1760        ),
     1761        'type'         => 'string',
     1762        'description'  => __( 'A city in the same timezone as you.' ),
     1763    ) );
     1764
     1765    register_setting( 'general', 'date_format', array(
     1766        'show_in_rest' => true,
     1767        'type'         => 'string',
     1768        'description'  => __( 'A date format for all date strings.' ),
     1769    ) );
     1770
     1771    register_setting( 'general', 'time_format', array(
     1772        'show_in_rest' => true,
     1773        'type'         => 'string',
     1774        'description'  => __( 'A time format for all time strings.' ),
     1775    ) );
     1776
     1777    register_setting( 'general', 'start_of_week', array(
     1778        'show_in_rest' => true,
     1779        'type'         => 'number',
     1780        'description'  => __( 'A day number of the week that the week should start on.' ),
     1781    ) );
     1782
     1783    register_setting( 'general', 'WPLANG', array(
     1784        'show_in_rest' => array(
     1785            'name' => 'language',
     1786        ),
     1787        'type'         => 'string',
     1788        'description'  => __( 'WordPress locale code.' ),
     1789        'default'      => 'en_US',
     1790    ) );
     1791
     1792    register_setting( 'writing', 'use_smilies', array(
     1793        'show_in_rest' => true,
     1794        'type'         => 'boolean',
     1795        'description'  => __( 'Convert emoticons like :-) and :-P to graphics on display.' ),
     1796        'default'      => true,
     1797    ) );
     1798
     1799    register_setting( 'writing', 'default_category', array(
     1800        'show_in_rest' => true,
     1801        'type'         => 'number',
     1802        'description'  => __( 'Default category.' ),
     1803    ) );
     1804
     1805    register_setting( 'writing', 'default_post_format', array(
     1806        'show_in_rest' => true,
     1807        'type'         => 'string',
     1808        'description'  => __( 'Default post format.' ),
     1809    ) );
     1810
     1811    register_setting( 'reading', 'posts_per_page', array(
     1812        'show_in_rest' => true,
     1813        'type'         => 'number',
     1814        'description'  => __( 'Blog pages show at most.' ),
     1815        'default'      => 10,
     1816    ) );
     1817}
     1818
     1819/**
    17111820 * Register a setting and its data.
    17121821 *
Note: See TracChangeset for help on using the changeset viewer.