Commit Graph

1182 Commits

Author SHA1 Message Date
Gary Pendergast
87675d288b Coding Standards: Fix all WordPress.WhiteSpace.PrecisionAlignment issues.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45602


git-svn-id: http://core.svn.wordpress.org/trunk@45413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:21:56 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45590


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Sergey Biryukov
c77e771c84 Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424


git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 00:12:54 +00:00
John Blackbourn
04bba79df9 Docs: Improve documentation for variadic functions relating to post type support and theme support.
See #37402

Built from https://develop.svn.wordpress.org/trunk@45422


git-svn-id: http://core.svn.wordpress.org/trunk@45233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-25 23:41:54 +00:00
Adam Silverstein
8e9315f51e Media: move get_available_post_mime_types to wp-includes/post.php making it more generally available.
Address an issue since r44947 where calling `wp_enqueue_media` on the front-end would result in a PHP fatal.

Props david.binda.
Fixes #46795.

Built from https://develop.svn.wordpress.org/trunk@45219


git-svn-id: http://core.svn.wordpress.org/trunk@45028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-16 20:30:51 +00:00
Aaron Jorbin
71cf332e65 Replace usages of basename() with wp_basename() in order to support multibyte filenames
This is focused on the pieces of code that touch media files and the tests that support them. `basename` isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.

Built from https://develop.svn.wordpress.org/trunk@44785


git-svn-id: http://core.svn.wordpress.org/trunk@44617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-01 20:58:52 +00:00
Gary Pendergast
7d17b53ff2 Blocks: Define the edit_posts capability on the wp_block post type.
Meta capability mapping doesn't recurse through multiple meta definitions, which creates a situation where the capabilities test is looking for the non-existent primitive capability `edit_blocks`, which should instead be mapped to `edit_posts`.

Defining the `edit_posts` capability when the `wp_block` post type is registered causes this check to change to to the `edit_posts` capability.

Props aduth.
Fixes #45373.


Built from https://develop.svn.wordpress.org/trunk@44687


git-svn-id: http://core.svn.wordpress.org/trunk@44518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-22 00:05:52 +00:00
desrosj
eaa03c3c8c Privacy: Include request counts inline with the filters in the list table views.
Fixes $44952
Props eArtboard, pratikkry, birgire, garrett-eclipse.
Built from https://develop.svn.wordpress.org/trunk@44668


git-svn-id: http://core.svn.wordpress.org/trunk@44499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 17:35:51 +00:00
Gary Pendergast
c0debca1f3 Docs: Improve the docblocks for wp_insert_post() and wp_set_post_categories().
Their respective `post_category` and `post_categories` parameters were not correct.

Props Takahashi_Fumiki.
Fixes #45171.


Built from https://develop.svn.wordpress.org/trunk@44660


git-svn-id: http://core.svn.wordpress.org/trunk@44491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 01:45:50 +00:00
Gary Pendergast
e42dddb5ba Docs: Mark the internal functions as @private in wp-includes/post.php.
Props shamim51.
Fixes #44502.


Built from https://develop.svn.wordpress.org/trunk@44636


git-svn-id: http://core.svn.wordpress.org/trunk@44467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-17 07:21:51 +00:00
Gary Pendergast
d2695fe283 Query: Cache the result when get_pages() doesn't find anything in the database.
Props flixos90, soulseekah.
Fixes #43514.


Built from https://develop.svn.wordpress.org/trunk@44587


git-svn-id: http://core.svn.wordpress.org/trunk@44418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-14 23:27:50 +00:00
Gary Pendergast
c008959e9e Coding Standards: Fix the minor WordPress.WP.I18n violations.
`WordPress.WP.I18n.MissingTranslatorsComment` is in progress in #44360.

See #45934.


Built from https://develop.svn.wordpress.org/trunk@44562


git-svn-id: http://core.svn.wordpress.org/trunk@44393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-11 06:04:49 +00:00
Felix Arntz
a71d208785 General: Fix problematic string to array parsing.
WordPress has historically often used code like `preg_split( '/[\s,]+/', $var )` to parse a string of comma-separated values into an array. However, this approach was causing an empty string to not be parsed into an empty array as expected, but rather into an array with the empty string as its sole element.

This was among other areas causing problems in the REST API where passing an empty request parameter could cause that request to fail because, instead of it being ignored, that parameter would be compared against the valid values for it, which typically do not include an empty string.

Props david.binda, sstoqnov.
Fixes #43977.

Built from https://develop.svn.wordpress.org/trunk@44546


git-svn-id: http://core.svn.wordpress.org/trunk@44377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 21:06:49 +00:00
Gary Pendergast
1b389ea861 Permalinks: Add a pre_wp_unique_post_slug filter.
Returning a non-`null` value on this fillter will cause `wp_unique_post_slug()` to return early with that value, skipping potentially expensive database queries on some sites.

Props coffee2code, javorszky, iCaleb.
Fixes #21112.


Built from https://develop.svn.wordpress.org/trunk@44454


git-svn-id: http://core.svn.wordpress.org/trunk@44285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 03:47:49 +00:00
Sergey Biryukov
cf9a5d83bd Docs: Update @since tag for edit_post_{$post->post_type} hook introduced in [43535].
Props garrett-eclipse.
Fixes #34706.
Built from https://develop.svn.wordpress.org/trunk@44347


git-svn-id: http://core.svn.wordpress.org/trunk@44177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-20 02:19:48 +00:00
Drew Jaynes
f05077e0b1 Docs: Add backtick escaping around a variable name in the DocBlock for update_post_meta().
Also adds a note to the description explaining that it can be used in place of `add_post_meta()`.

See #42505.

Built from https://develop.svn.wordpress.org/trunk@44334


git-svn-id: http://core.svn.wordpress.org/trunk@44164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 16:39:48 +00:00
Jeremy Felt
c9f8525211 Blocks: Include necessary labels for the 'wp_block' post type.
Merges [43849] from the 5.0 branch to trunk.

Props danielbachhuber.
See #45098.

Built from https://develop.svn.wordpress.org/trunk@44215


git-svn-id: http://core.svn.wordpress.org/trunk@44045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-16 01:25:52 +00:00
desrosj
268402cf53 PHP7.3 compatibility: Fix compact throwing notices.
In PHP 7.3, the `compact()` function has been changed to issue an `E_NOTICE` level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

Props jorbin, desrosj.

Merges [43819] and [43832] to trunk.

Fixes #44416.
Built from https://develop.svn.wordpress.org/trunk@44166


git-svn-id: http://core.svn.wordpress.org/trunk@43996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 05:13:52 +00:00
Jeremy Felt
c3e927d2c8 REST API: Add endpoints for blocks.
`WP_REST_Block_Renderer_Controller` allows rendering of server-side rendered blocks, whilst `WP_REST_Blocks_Controller` allows retrieving of reusable blocks.

Merges [43805] and [43806] from the 5.0 branch to trunk.

Props desrosj, danielbachhuber, pento, Presskopp, swissspidy.
See #45065, #45098.

Built from https://develop.svn.wordpress.org/trunk@44150


git-svn-id: http://core.svn.wordpress.org/trunk@43980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 02:35:38 +00:00
Jeremy Felt
3af9743b81 Blocks: Add the reusable block post type, wp_block.
Merges [43804] from the 5.0 branch to trunk.

See #45098.

Built from https://develop.svn.wordpress.org/trunk@44146


git-svn-id: http://core.svn.wordpress.org/trunk@43976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 02:15:37 +00:00
Gary Pendergast
25366bd41f Posts, Post Types: Add labels for post transformation messages.
Because the existing `post_updated_messages` filter can be modified dynamically based on post state, it's unreliable to use with REST API clients. Instead, these new labels give clients stateless equivalents.

Merges [43744] from the 5.0 branch to trunk.

Props earnjam.
Fixes #45101.

Built from https://develop.svn.wordpress.org/trunk@44110


git-svn-id: http://core.svn.wordpress.org/trunk@43940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 09:57:24 +00:00
Jeremy Felt
2dce718157 REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Merges [43729] to trunk.

Props flixos90, spacedmonkey.
Fixes #44467.

Built from https://develop.svn.wordpress.org/trunk@43982


git-svn-id: http://core.svn.wordpress.org/trunk@43814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:02:24 +00:00
Sergey Biryukov
f7ba175491 Docs: Correct @since value for _wp_privacy_statuses().
Fix typo in `@since` entry for `WP_Privacy_Policy_Content:add()`.

Props dimadin.
Fixes #44915.
Built from https://develop.svn.wordpress.org/trunk@43638


git-svn-id: http://core.svn.wordpress.org/trunk@43467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-13 10:20:24 +00:00
Sergey Biryukov
7c366e8889 Docs: Update @since version for edit_post_{$post->post_type} action introduced in [43535] to 4.9.9.
See #34706.
Built from https://develop.svn.wordpress.org/trunk@43616


git-svn-id: http://core.svn.wordpress.org/trunk@43445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-03 21:09:27 +00:00
John Blackbourn
47d32decd6 Docs: Correct and improve various inline documentation.
See #42505

Built from https://develop.svn.wordpress.org/trunk@43582


git-svn-id: http://core.svn.wordpress.org/trunk@43411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-27 14:28:26 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Sergey Biryukov
9c084c6968 Posts, Post Types: Introduce edit_post_{$post->post_type} hook.
The hook fires before the general `edit_post` hook and has the same parameters.

It also complements the `save_post_{$post->post_type}` hook added in [25050].

Props Mte90, garrett-eclipse.
Fixes #34706.
Built from https://develop.svn.wordpress.org/trunk@43535


git-svn-id: http://core.svn.wordpress.org/trunk@43364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-25 20:57:25 +00:00
K. Adam White
a7735117b6 Docs: Update @since version to 4.9.8 for meta registration subtype handling.
This feature has been backported to 4.9.8 so 5.0.0 is inaccurate.

See #38323.

Built from https://develop.svn.wordpress.org/trunk@43520


git-svn-id: http://core.svn.wordpress.org/trunk@43349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-23 17:02:25 +00:00
John Blackbourn
c9dce0606b Media: Limit thumbnail file deletions to the same directory as the original file.
Built from https://develop.svn.wordpress.org/trunk@43392


git-svn-id: http://core.svn.wordpress.org/trunk@43220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-05 14:32:25 +00:00
K. Adam White
a89c86c711 REST API: Support meta registration for specific object subtypes.
Introduce an `object_subtype` argument to the args array for `register_meta()` which can be used to limit meta registration to a single subtype (e.g. a custom post type or taxonomy, vs all posts or taxonomies).

Introduce `register_post_meta()` and `register_term_meta()` wrapper methods for `register_meta` to provide a convenient interface for the common case of registering meta for a specific taxonomy or post type. These methods work the way plugin developers have often expected `register_meta` to function, and should be used in place of direct `register_meta` where possible.

Props flixos90, tharsheblows, spacedmonkey.
Fixes #38323.


Built from https://develop.svn.wordpress.org/trunk@43378


git-svn-id: http://core.svn.wordpress.org/trunk@43206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:43:21 +00:00
Andrew Ozz
e9eb7518c0 Privacy: update and enhance the method to confirm user requests by email. Introduce WP_User_Request to hold all request vars similarly to WP_Post.
Props mikejolley.
See #43443.

Built from https://develop.svn.wordpress.org/trunk@43011


git-svn-id: http://core.svn.wordpress.org/trunk@42840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 17:31:22 +00:00
Andrew Ozz
f1703c0e70 Privacy: update the method to confirm user requests by email. Use a single CPT to store the requests and to allow logging/audit trail.
Props mikejolley.
See #43443.

Built from https://develop.svn.wordpress.org/trunk@43008


git-svn-id: http://core.svn.wordpress.org/trunk@42837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 10:12:22 +00:00
Andrew Ozz
108578a8ec Privacy: add new wp-admin screens for exporting and removing of personal data.
Props @melchoyce, @mikejolley, @allendav, @xkon.
See #43481.
Built from https://develop.svn.wordpress.org/trunk@42967


git-svn-id: http://core.svn.wordpress.org/trunk@42796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-10 18:02:30 +00:00
John Blackbourn
2361ca884f Docs: Document more parameters and properties using typed array notation.
See #41756

Built from https://develop.svn.wordpress.org/trunk@42876


git-svn-id: http://core.svn.wordpress.org/trunk@42706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:33:31 +00:00
Dominik Schilling
74cb5936fc Docs: Remove trailing whitespace in wp-includes/post.php.
Built from https://develop.svn.wordpress.org/trunk@42769


git-svn-id: http://core.svn.wordpress.org/trunk@42599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-02 10:02:33 +00:00
Drew Jaynes
6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

Built from https://develop.svn.wordpress.org/trunk@42710


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54:31 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42678


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
John Blackbourn
f7224ea635 Docs: Copy a helpful inline doc into the function header for visibility.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42664


git-svn-id: http://core.svn.wordpress.org/trunk@42493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-07 22:13:30 +00:00
Gary Pendergast
488df7c563 Docs: Correct some version numbers.
`wp_check_for_changed_dates()`, `_find_post_by_old_slug(), `_find_post_by_old_date()`, and the `old_slug_redirect_post_id` filter were intended to land in 4.9.2, but didn't quite make it. Instead, they'll be landing in 4.9.3.

See #15397.


Built from https://develop.svn.wordpress.org/trunk@42588


git-svn-id: http://core.svn.wordpress.org/trunk@42417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-24 06:48:31 +00:00
Gary Pendergast
6da54f0d9b Canonical URLs: Redirect to the correct URL when the post date changes.
When a post slug is changed, we store a copy of the old slug, so that we can redirect visitors visiting the old URL to the new URL.

In the same way, this stores a copy of the old date, when the post date changes, so we can redirect visitors to the new URL.

Props nickmomrik.
Fixes #15397 for trunk.


Built from https://develop.svn.wordpress.org/trunk@42401


git-svn-id: http://core.svn.wordpress.org/trunk@42230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-15 08:31:47 +00:00
Sergey Biryukov
ff89ce1879 Posts: Rename $ID to $post in get_post_mime_type() and get_post_status() for consistency with other functions.
See #42797.
Built from https://develop.svn.wordpress.org/trunk@42398


git-svn-id: http://core.svn.wordpress.org/trunk@42227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-15 01:03:47 +00:00
Sergey Biryukov
0d09b75c4b Docs: Add missing parameter description in wp_get_post_parent_id() function DocBlock.
Rename `$post_ID` to `$post` for consistency with other functions.

Add unit tests for `wp_get_post_parent_id()`.

Props keesiemeijer.
Fixes #42797.
Built from https://develop.svn.wordpress.org/trunk@42397


git-svn-id: http://core.svn.wordpress.org/trunk@42226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-15 01:02:48 +00:00
Dion Hulse
ea74239f90 Posts: When using wp_update_post() on a attachment post_type item, pass the $wp_error parameter through to wp_insert_attachment().
Props MyThemeShop.
Fixes #41513.

Built from https://develop.svn.wordpress.org/trunk@42383


git-svn-id: http://core.svn.wordpress.org/trunk@42212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-11 06:37:50 +00:00
John Blackbourn
ee51200c50 Role/Capability: When checking capabilities before setting a post slug, ensure the correct post type capabilities are used.
Previously, only the `publish_posts` capability was checked. Now, the correct meta or primitive capability for the post type is used where appropriate.

Props peterwilsoncc

Fixes #42464

Built from https://develop.svn.wordpress.org/trunk@42380


git-svn-id: http://core.svn.wordpress.org/trunk@42209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-09 22:51:54 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Dion Hulse
611c090b41 Docs: Update the documentation for get_post_meta() to clarify that $single has no effect when the $meta_key is not provided.
Props chetan200891, titodevera.
Fixes #42687.

Built from https://develop.svn.wordpress.org/trunk@42227


git-svn-id: http://core.svn.wordpress.org/trunk@42056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 03:17:54 +00:00
Gary Pendergast
a2693fd860 Database: Restore numbered placeholders in wpdb::prepare().
[41496] removed support for numbered placeholders in queries send through `wpdb::prepare()`, which, despite being undocumented, were quite commonly used.

This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to `wpdb::prepare()`, given the number of placeholders.

See #41925.


Built from https://develop.svn.wordpress.org/trunk@42056


git-svn-id: http://core.svn.wordpress.org/trunk@41885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-31 12:00:49 +00:00
Boone Gorges
a1879766ed Bump 'posts' query cache incrementor when modifying postmeta.
This ensures that the `get_pages()` query cache doesn't go stale when
postmeta is modified.

Props spacedmonkey.
Fixes #40669.
Built from https://develop.svn.wordpress.org/trunk@41849


git-svn-id: http://core.svn.wordpress.org/trunk@41683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-12 15:20:47 +00:00
John Blackbourn
4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

Built from https://develop.svn.wordpress.org/trunk@41688


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Weston Ruter
e0c3951b08 Embeds: Cache oEmbeds in an oembed_cache custom post type instead of postmeta when there is no global $post.
Add processing of embeds to rich Text widget.

Props swissspidy, westonruter, ocean90, johnbillion.
See #40854, #39994, #40935.
Fixes #34115.

Built from https://develop.svn.wordpress.org/trunk@41651


git-svn-id: http://core.svn.wordpress.org/trunk@41485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-30 01:15:48 +00:00
Sergey Biryukov
79ffa7ff2a Posts, Post Types: In wp_delete_post(), wp_trash_post(), wp_untrash_post(), and wp_delete_attachment(), standardize on WP_Post as a return value and internal representation of the post data.
Props bor0, SergeyBiryukov.
Fixes #42030.
Built from https://develop.svn.wordpress.org/trunk@41642


git-svn-id: http://core.svn.wordpress.org/trunk@41476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 13:36:46 +00:00
Sergey Biryukov
70925e6741 Posts, Post Types: Introduce pre_trash_post and pre_untrash_post filters to allow for short-circuiting wp_trash_post() and wp_untrash_post().
This brings parity with `pre_delete_post` filter in `wp_delete_post()`, introduced in [34082].

Props bor0.
Fixes #42030.
Built from https://develop.svn.wordpress.org/trunk@41638


git-svn-id: http://core.svn.wordpress.org/trunk@41472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 10:19:49 +00:00
Sergey Biryukov
3d6c0dc45a Docs: Remove "since since" and "one one" dittography from inline comments.
Fixes #41841.
Built from https://develop.svn.wordpress.org/trunk@41355


git-svn-id: http://core.svn.wordpress.org/trunk@41188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-09 13:53:42 +00:00
John Blackbourn
9891448a42 Media: Rename several attachment related parameters from $post_id to $attachment_id for clarity, and improve related
documentation.

See #41017

Built from https://develop.svn.wordpress.org/trunk@41288


git-svn-id: http://core.svn.wordpress.org/trunk@41128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-22 11:12:44 +00:00
Drew Jaynes
597eeb9bb8 Docs: Use a hash notation for the $args parameter to describe the fields argument in the DocBlock for wp_get_post_terms().
Also, the `$taxonomy` parameter can accept either a string or array of taxonomies.

Props ohryan for the initial tip.
See #41017.

Built from https://develop.svn.wordpress.org/trunk@41034


git-svn-id: http://core.svn.wordpress.org/trunk@40884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-12 22:21:41 +00:00
Sergey Biryukov
cf458a871d Docs: Document tags_input parameter in wp_insert_post().
Props barryceelen.
Fixes #41137.
Built from https://develop.svn.wordpress.org/trunk@40925


git-svn-id: http://core.svn.wordpress.org/trunk@40775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-23 21:27:44 +00:00
John Blackbourn
8d3d439684 Posts, Post Types: Correct the fallback value for the label_count argument of register_post_status().
While using `_n_noop()` here is technically incorrect, it does correct the fallback value as its usage in `translate_nooped_plural()` expects a correctly formatted associative array.

Props xrmx

Fixes #38686

Built from https://develop.svn.wordpress.org/trunk@40516


git-svn-id: http://core.svn.wordpress.org/trunk@40392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-22 14:17:42 +00:00
Sergey Biryukov
35987df4e4 Docs: Improve @param and @return entries for wp_get_post_categories(), wp_get_post_tags(), and wp_get_post_terms().
Props philipjohn, theMikeD.
Fixes #40481.
Built from https://develop.svn.wordpress.org/trunk@40483


git-svn-id: http://core.svn.wordpress.org/trunk@40359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-19 23:08:40 +00:00
Sergey Biryukov
fe0b8a2aaf Pings/Trackbacks: Avoid scheduling multiple do_pings events in _publish_post_hook().
Props ethitter.
Fixes #39828.
Built from https://develop.svn.wordpress.org/trunk@40054


git-svn-id: http://core.svn.wordpress.org/trunk@39991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-10 03:09:43 +00:00
Sergey Biryukov
b0bcea2a18 Docs: Clarify that wp_list_pages() and get_pages() only work with hierarchical post types.
Props doublehhh.
Fixes #39369.
Built from https://develop.svn.wordpress.org/trunk@40027


git-svn-id: http://core.svn.wordpress.org/trunk@39964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-29 10:59:42 +00:00
Sergey Biryukov
f3a9d2bd9a I18N: Add post type context to "Featured Image" post labels.
Fixes #39458.
Built from https://develop.svn.wordpress.org/trunk@39667


git-svn-id: http://core.svn.wordpress.org/trunk@39607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-04 08:40:41 +00:00
Sergey Biryukov
962db75ace Posts, Post Types: Add a @since entry for archives post type label introduced in [35382].
See #16075.
Built from https://develop.svn.wordpress.org/trunk@39666


git-svn-id: http://core.svn.wordpress.org/trunk@39606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-04 08:21:43 +00:00
John Blackbourn
4548b08236 General: Use interpolation instead of concatenation for all dynamic hook names.
This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148

Built from https://develop.svn.wordpress.org/trunk@39600


git-svn-id: http://core.svn.wordpress.org/trunk@39540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-14 04:18:42 +00:00
James Nylen
505e135f4c REST API: Add support for filename search in media endpoint.
In [38625], the functionality to search for attachments by filename was added
via the `posts_clauses` filter and the `_filter_query_attachment_filenames()`
function.  This moves `_filter_query_attachment_filenames()` from
`wp-admin/includes/post.php` to `wp-includes/post.php` so that it can be
applied in the same manner in the REST API media endpoint.

Props jblz, tyxla.
Fixes #39092.

Built from https://develop.svn.wordpress.org/trunk@39598


git-svn-id: http://core.svn.wordpress.org/trunk@39538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-13 14:09:42 +00:00
Weston Ruter
3b37903106 Customize: Defer populating post_name for auto-draft posts in customized state until posts are published.
The ultimate `post_name` is stored in postmeta until the post is published. The `get_page_by_path()` function does not exclude `auto-draft` posts. Revert changes to `wp_unique_post_slug()` from [39411] which excluded `auto-draft` posts.

Props westonruter, dlh for testing, helen for testing.
See #38114, #38928.
Fixes #39078.

Built from https://develop.svn.wordpress.org/trunk@39506


git-svn-id: http://core.svn.wordpress.org/trunk@39446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-05 19:33:42 +00:00
Gary Pendergast
947888d243 Docs: Add missing REST API-related args to register_post_type() and register_taxonomy().
These functions now accept the `show_in_rest`, `rest_base`, and `rest_controller_class` args.

Props ketuchetan, rahulsprajapati.
Fixes #39023.


Built from https://develop.svn.wordpress.org/trunk@39462


git-svn-id: http://core.svn.wordpress.org/trunk@39402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-03 04:48:42 +00:00
Weston Ruter
71d5ba249b Customize: Reuse existing non-auto-draft posts and existing auto-draft posts in the customized state with matching slugs when applying starter content.
* Updates `wp_unique_post_slug()` to ignore `auto-draft` posts. Prevents publishing multiple posts that have the same slugs from starter content.
* Fixes fatal error when attempting to save an header_image setting from a non-admin context.
* Fixes substituting attachment symbols in options and theme mods.
* Fixes applying starter content for header images and background images.

See #38114.
Fixes #38928.

Built from https://develop.svn.wordpress.org/trunk@39411


git-svn-id: http://core.svn.wordpress.org/trunk@39351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-02 00:25:41 +00:00
Helen Hou-Sandí
70fc99e323 Theme starter content: Add support for featured images and page templates.
Featured image support means that attachments can now be imported. Media can be sideloaded from within theme or plugin directories. Like other posts, attachments are auto-drafts until customizer changes are published, and are not duplicated when they already exist in the customized state. Attachment IDs can be used for any number of purposes, much like post IDs. Twenty Seventeen now includes 3 images used as featured images to best showcase the multi-section homepage setup.

As featured image IDs are stored in post meta, it also made sense to add support for page templates. Twenty Seventeen does not include any such templates, but the functionality can be quite important for displaying themes to their best effect.

props westonruter, helen, flixos90.
fixes #38615.

Built from https://develop.svn.wordpress.org/trunk@39346


git-svn-id: http://core.svn.wordpress.org/trunk@39286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 09:53:33 +00:00
Sergey Biryukov
acc30b09d7 Text Changes: Merge some duplicate strings with the same meaning in error messages, adjust some other strings for consistency and accuracy.
Props ramiy, SergeyBiryukov.
Fixes #38808.
Built from https://develop.svn.wordpress.org/trunk@39278


git-svn-id: http://core.svn.wordpress.org/trunk@39218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 15:53:33 +00:00
John Blackbourn
b9033ad6a1 Docs: Improve the documentation for parameters which accept OBJECT, ARRAY_A, and ARRAY_N as parameters.
See #37770

Built from https://develop.svn.wordpress.org/trunk@39188


git-svn-id: http://core.svn.wordpress.org/trunk@39128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 23:00:32 +00:00
Weston Ruter
08712b4baa Customize: Rename unfiltered_css meta capability to edit_css; add revisions support to custom_css post type.
Props lukecavanagh, georgestephanis, westonruter.
See #38672, #35395.

Built from https://develop.svn.wordpress.org/trunk@39175


git-svn-id: http://core.svn.wordpress.org/trunk@39115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 01:12:30 +00:00
Pascal Birchler
81a26f6900 Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages.
While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types.

By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility.

In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`.
When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type.

Props johnbillion, Mte90, dipesh.kakadiya, swissspidy.
Fixes #18375.
Built from https://develop.svn.wordpress.org/trunk@38951


git-svn-id: http://core.svn.wordpress.org/trunk@38894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 08:07:30 +00:00
Rachel Baker
2f263fce99 Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds.
Fixes bug where an invalid Last-Modified value would be returned in feed requests for sites that had 0 items to return. Comment or post feeds will now return the current timestamp as the Last-Modified header value.  Example: a request for the comments feed for a site without any comments.

Replaced use of the local static variable `$cache_lastcommentmodified` to store the modified date in `get_lastcommentmodified()` with the Object Cache API.  The `get_lastcommentmodified()` function returns early if there is a cached value and returns `false` if there where no comments found. Introduced `_clear_modified_cache_on_transition_comment_status()` to flush the `lastcommentmodified` cache key when a comment enters or leaves approval status. In `get_lastpostmodified()` return early if there is a cached value and return `false` if there are no posts found.

Props swissspidy, rachelbaker, dllh, leobaiano.
Fixes #38027.
Built from https://develop.svn.wordpress.org/trunk@38925


git-svn-id: http://core.svn.wordpress.org/trunk@38868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 20:48:29 +00:00
Gary Pendergast
16f0c6877e Pings: Allow ping functions to accept WP_Post objects as well as post IDs.
This removes the use of several `global $wpdb` instances, as well as bringing the ping functions into line with other post-related functions, which will accept a post ID or `WP_Post` object.

Props dshanke.
Fixes #38202.


Built from https://develop.svn.wordpress.org/trunk@38852


git-svn-id: http://core.svn.wordpress.org/trunk@38795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 06:00:31 +00:00
Aaron Jorbin
82911b1756 Cache API: introduce wp_cache_get_last_changed to improve DRY
One thing fairly common to the cache groups is a block of code to look to see when the cache was last changed, and if there isn't one, to set it for the current microtime(). It appears in 8 different places in core. This adds a new helper `wp_cache_get_last_changed` to DRY things up a bit.

Since `wp-includes/cache.php` isn't guaranteed to be loaded, this new function is in `wp-includes/functions.php`

Props spacedmonkey, desrosj.
Fixes #37464.


Built from https://develop.svn.wordpress.org/trunk@38849


git-svn-id: http://core.svn.wordpress.org/trunk@38792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 02:54:34 +00:00
Rachel Baker
e4a7c0a397 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.
Built from https://develop.svn.wordpress.org/trunk@38832


git-svn-id: http://core.svn.wordpress.org/trunk@38775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-20 02:55:32 +00:00
Weston Ruter
1ccd9e7a6c Customize: Introduce custom CSS for extending theme styles.
* Custom CSS is associated with a given theme and is displayed in an inline `style` element at the `wp_head` hook after the `wp_print_styles` is called so that it overrides any enqueued stylesheets.
* A `wp_get_custom_css()` function is used for accessing the CSS associated with the current theme (or another theme) and a `wp_get_custom_css` filter for manipulating it.
* CSS is managed in customizer via a new "Additional CSS" section with a single `textarea` control. 
* `WP_Customize_Section::$description_hidden` is introduced for hiding extended descriptions in customizer sections behind a help toggle as done with panels.
* CSS is stored in a `custom_css` post type with the theme (stylesheet) slug as the `post_name`.
* `WP_Customize_Custom_CSS_Setting` is introduced to handle validation of CSS, previewing, and persisting the CSS to the `custom_css` post type.
* The `custom_css` setting is tied to a new `unfiltered_css` capability which maps to `unfiltered_html` by default.
* Escaping the message in the notification template is removed to allow markup (`code` tags) to be rendered.

See https://make.wordpress.org/core/2016/10/11/feature-proposal-better-theme-customizations-via-custom-css-with-live-previews/

Props johnregan3, celloexpressions, folletto, westonruter.
Fixes #35395.

Built from https://develop.svn.wordpress.org/trunk@38829


git-svn-id: http://core.svn.wordpress.org/trunk@38772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 18:15:31 +00:00
Weston Ruter
f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

Built from https://develop.svn.wordpress.org/trunk@38810


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +00:00
Sergey Biryukov
4a95bfa4c2 Docs: In get_pages() and wp_list_pages(), note that post_status argument can also be an array.
Adjust the alignment of default argument values for better readability.

Props birgire, desrosj.
Fixes #38136.
Built from https://develop.svn.wordpress.org/trunk@38798


git-svn-id: http://core.svn.wordpress.org/trunk@38741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-16 01:10:31 +00:00
Pascal Birchler
8fe586ad57 Toolbar: Add a 'View Posts' link to the toolbar when on the post listing screen.
This adds a new link to visit the post type archive if the post type supports it. Also introduces a new `view_items` label to `get_post_type_labels()`.

Props paulwilde, akibjorklund, swissspidy.
Fixes #34113.
Built from https://develop.svn.wordpress.org/trunk@38634


git-svn-id: http://core.svn.wordpress.org/trunk@38577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 20:02:28 +00:00
John Blackbourn
e0a0be9579 Media: Add a $wp_error parameter to wp_insert_attachment() to give it parity with wp_insert_post().
Fixes #37813
Props grapplerulrich, mrahmadawais

Built from https://develop.svn.wordpress.org/trunk@38408


git-svn-id: http://core.svn.wordpress.org/trunk@38349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 17:25:29 +00:00
Sergey Biryukov
64dac53d70 I18N: Use a consistent context for "Add New" submenu strings in admin bar (Toolbar).
Props ramiy.
Fixes #37780.
Built from https://develop.svn.wordpress.org/trunk@38326


git-svn-id: http://core.svn.wordpress.org/trunk@38267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 01:42:32 +00:00
Dominik Schilling
75d4429926 Post Thumbnails: Restore thumbnail support for media files.
* Allow to add/remove a featured image to `attachment:audio` and `attachment:video` post types, see [27657].
* Change conditionals to check for theme OR post type support.
* Add tests for #12922.

Broken in [37658].

Props flixos90, joemcgill, DrewAPicture, wonderboymusic.
See #12922.
Fixes #37658.
Built from https://develop.svn.wordpress.org/trunk@38263


git-svn-id: http://core.svn.wordpress.org/trunk@38204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-15 19:16:31 +00:00
John Blackbourn
ab052361a3 Docs: Correct and clarify various @since docs.
Fixes #37562

Built from https://develop.svn.wordpress.org/trunk@38201


git-svn-id: http://core.svn.wordpress.org/trunk@38142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-04 22:54:31 +00:00
Sergey Biryukov
db9ec644f5 Permalinks: In get_page_uri(), don't prepend a parent page slug if it's empty.
Props inderpreet99, SergeyBiryukov.
Fixes #36174.
Built from https://develop.svn.wordpress.org/trunk@38145


git-svn-id: http://core.svn.wordpress.org/trunk@38086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-23 10:05:49 +00:00
Drew Jaynes
e6267dcf19 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.

Built from https://develop.svn.wordpress.org/trunk@38125


git-svn-id: http://core.svn.wordpress.org/trunk@38066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 19:33:30 +00:00
Joe McGill
3dbba0fff3 Post Thumbnails: Only update featured images when saving a post.
Previously, changing the post thumbnail of a published post in the edit screen
would immediately apply the change, rather than waiting for the post to be
saved before applying the update. This could lead to someone unintentionally
editing the post thumbnail on a published post, and made it impossible to
preview changes to post thumbnails on published posts before saving the change.

This introduces a new Ajax handler, `wp_ajax_get_post_thumbnail_html()` to
retrieve the HTML for the post thumbnail meta box without updating the post
meta value for `_thumbnail_id`. It also allows post thumbnail changes to be
previewed by passing the `_thumbnail_id` as a query variable to the preview
screen and adding a new filter, `_wp_preview_post_thumbnail_filter()`, which
gets applied to `get_post_metadata` during the post preview process.

Props flixos90.
Fixes #12922.
Built from https://develop.svn.wordpress.org/trunk@38118


git-svn-id: http://core.svn.wordpress.org/trunk@38059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:24:28 +00:00
Sergey Biryukov
866bd39813 I18N: Combine two duplicate "Invalid post type" strings.
Props @ramiy.
See #18218.
Built from https://develop.svn.wordpress.org/trunk@38076


git-svn-id: http://core.svn.wordpress.org/trunk@38017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-17 16:05:31 +00:00
Sergey Biryukov
f5aab6e25d Docs: Correct $post parameter name and description for wp_attachment_is() and wp_attachment_is_image().
Props flixos90.
Fixes #37377.
Built from https://develop.svn.wordpress.org/trunk@38068


git-svn-id: http://core.svn.wordpress.org/trunk@38009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-16 13:05:29 +00:00
Drew Jaynes
60de6917fb Docs: Add and clarify changelog entries for elements that can now accept, use, or return WP_Post_Type objects.
Also adds a missing initial `@since` version for `wp_xmlrpc_server::_prepare_post_type()`.

See [37890]. See #36217.

Built from https://develop.svn.wordpress.org/trunk@38051


git-svn-id: http://core.svn.wordpress.org/trunk@37992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 15:24:28 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Joe McGill
170d22a22c Post Thumbnails: Add helper functions for attachment captions.
This adds three new functions for getting/displaying attachment captions:

* `wp_get_attachment_caption` - Retrieves a caption for a specific attachment.
* `get_the_post_thumbnail_caption()` - Returns the post thumbnail caption.
* `the_post_thumbnail_caption()` - Displays the post thumbnail caption.

These are helpful for displaying a caption associated with an image directly
in a template, rather than using the caption shortcode.

This also introduces two new filters:

* `wp_get_attachment_caption` - Filters the value of `wp_get_attachment_caption()`.
* `the_post_thumbnail_caption` - Filters the display of the post thumbnail caption.

`the_post_thumbnail_caption()` is automatically filtered by `wptexturize()`,
`convert_smilies()`, and `convert_chars()` in `wp-includes/default-filters.php`.

Props flixos90, joemcgill.
Fixes #12235.
Built from https://develop.svn.wordpress.org/trunk@37915


git-svn-id: http://core.svn.wordpress.org/trunk@37856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 17:28:28 +00:00
Dominik Schilling
60dc856d64 Posts: Introduce WP_Post_Type and use it in register_post_type() and unregister_post_type().
This changes the global `$wp_post_types` to an array of `WP_Post_Type` objects. `WP_Post_Type` includes methods to handle post type supports, rewrite rules, meta boxes, hooks, and taxonomies.
Each post type argument becomes a property of `WP_Post_Type`.

Props swissspidy, flixos90.
Fixes #36217.
Built from https://develop.svn.wordpress.org/trunk@37890


git-svn-id: http://core.svn.wordpress.org/trunk@37831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 16:41:35 +00:00
Drew Jaynes
0ef938e9da Docs: Improve formatting and syntax of the defaullt label docs in the DocBlock for get_post_type_labels().
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37886


git-svn-id: http://core.svn.wordpress.org/trunk@37827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 07:18:27 +00:00
Drew Jaynes
538eb01e6f Docs: Add a more complete $labels parameter description to the DocBlock for register_post_type().
Directly references `get_post_type_labels()` for the full list of supported labels.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37885


git-svn-id: http://core.svn.wordpress.org/trunk@37826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 06:42:28 +00:00
Drew Jaynes
112992ba80 Docs: Improve the $post_type parameter description in the DocBlock for register_post_type().
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37884


git-svn-id: http://core.svn.wordpress.org/trunk@37825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 06:37:28 +00:00
Drew Jaynes
d4ae5b76ee Docs: Add more complete documentation for the $supports argument in register_post_type().
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37883


git-svn-id: http://core.svn.wordpress.org/trunk@37824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 06:32:27 +00:00
Drew Jaynes
9ef5fb0a17 Docs: Improve the usefulness, accuracy, and syntax of the register_post_type() DocBlock summary and description.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37882


git-svn-id: http://core.svn.wordpress.org/trunk@37823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 06:27:32 +00:00
Jeremy Felt
6f3f00ea97 Multisite: Change WP_Network id property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

Built from https://develop.svn.wordpress.org/trunk@37870


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Drew Jaynes
1e48cc8a05 Docs: Improve the return description for wp_get_post_categories() to include more information about possible return values.
Props jeherve for the initial patch.
Fixes #37002.

Built from https://develop.svn.wordpress.org/trunk@37686


git-svn-id: http://core.svn.wordpress.org/trunk@37652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-11 17:08:28 +00:00
Drew Jaynes
9193013158 Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

Fixes #36921.

Built from https://develop.svn.wordpress.org/trunk@37544


git-svn-id: http://core.svn.wordpress.org/trunk@37512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:02:28 +00:00
Drew Jaynes
dcadd35728 Docs: Standardize filter docs in wp-includes/post.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37504


git-svn-id: http://core.svn.wordpress.org/trunk@37472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:31:28 +00:00
Drew Jaynes
f52a8cb1fa Docs: Remove/replace invalid inline @link tags in DocBlocks in wp-includes/*.
Fixes #36910.

Built from https://develop.svn.wordpress.org/trunk@37487


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Boone Gorges
4428a031a3 In get_page_by_path(), values fetched from cache should obey $output param.
Introduced in [37479].

Props spacedmonkey.
Fixes #36711.
Built from https://develop.svn.wordpress.org/trunk@37481


git-svn-id: http://core.svn.wordpress.org/trunk@37449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 16:19:29 +00:00
Boone Gorges
98050e404d Cache queries in get_page_by_path().
Props spacedmonkey.
Fixes #36711.
Built from https://develop.svn.wordpress.org/trunk@37479


git-svn-id: http://core.svn.wordpress.org/trunk@37447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-21 17:27:29 +00:00
Sergey Biryukov
ff37a3b730 Docs: Fix typo in a comment in check_and_publish_future_post().
See #32246.
Built from https://develop.svn.wordpress.org/trunk@37403


git-svn-id: http://core.svn.wordpress.org/trunk@37369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-08 12:46:29 +00:00
Eric Lewis
aba14233d9 Posts: Allow get_page_uri() to be called without a $page argument.
`get_page_uri()` can now be called without an argument, which will return the page URI for the current post in the loop.

Props pollett.
Fixes #26284.

Built from https://develop.svn.wordpress.org/trunk@37345


git-svn-id: http://core.svn.wordpress.org/trunk@37311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 18:29:29 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Sergey Biryukov
49a47bb255 Docs: Document the @return value of wp_add_trashed_suffix_to_post_name_for_post().
Props Shelob9.
Fixes #36728.
Built from https://develop.svn.wordpress.org/trunk@37334


git-svn-id: http://core.svn.wordpress.org/trunk@37300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-01 10:16:29 +00:00
Boone Gorges
742e0005c6 Add parameter documentation for 'post_category' to wp_insert_post().
Props Latz.
Fixes #36601.
Built from https://develop.svn.wordpress.org/trunk@37255


git-svn-id: http://core.svn.wordpress.org/trunk@37221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-20 13:54:30 +00:00
Boone Gorges
374a489166 In sanitize_post_field(), only run 'attribute' or 'js' escaping when necessary.
Props tfrommen.
Fixes #34900.
Built from https://develop.svn.wordpress.org/trunk@37220


git-svn-id: http://core.svn.wordpress.org/trunk@37186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-16 14:51:28 +00:00
Boone Gorges
cfab9716e3 Use __trashed suffix rather than -%trashed% for trashed post slugs.
Percent signs are reserved characters in URIs. As such, it was impossible for
plugins to route requests to trashed posts, as happens in bbPress. The new
`__trashed` suffix should be sufficiently unique.

Also adds a test that demonstrates that the `__trashed` suffix can be
appended to slugs that contain the suffix somewhere other than the end of
the string.

Props netweb, ericlewis.
Fixes #11863.
Built from https://develop.svn.wordpress.org/trunk@37165


git-svn-id: http://core.svn.wordpress.org/trunk@37132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-07 19:22:28 +00:00
Drew Jaynes
f9919442e2 Docs: Improve the DocBlock summary for wp_queue_posts_for_term_meta_lazyload(), introduced in [36566].
See #35816. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36945


git-svn-id: http://core.svn.wordpress.org/trunk@36913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 18:29:26 +00:00
Drew Jaynes
49803ffabe Docs: Improve the accuracy of the return description for unregister_post_type(), introduced in [36316].
See #14761. See #35986.

Built from https://develop.svn.wordpress.org/trunk@36944


git-svn-id: http://core.svn.wordpress.org/trunk@36912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 18:25:25 +00:00
Boone Gorges
e032560e6b Correct @return annotation for wp_set_object_terms() and related functions.
The return value is an array of term taxonomy IDs, not term IDs.

Fixes #36182.
Built from https://develop.svn.wordpress.org/trunk@36896


git-svn-id: http://core.svn.wordpress.org/trunk@36864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 16:17:28 +00:00
Drew Jaynes
2846e3aaef Docs: Use the correct variable name for the $post_ID parameter in the DocBlock for wp_add_trashed_suffix_to_post_name_for_trashed_posts().
See #11863. See #32246.

Built from https://develop.svn.wordpress.org/trunk@36727


git-svn-id: http://core.svn.wordpress.org/trunk@36694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 09:25:26 +00:00
Drew Jaynes
1b9a705394 Docs: Standardize summaries for two new internal functions used to handle suffixing trashed posts.
Also adds a notation of private access to each.

See #11863. See #32246.

Built from https://develop.svn.wordpress.org/trunk@36726


git-svn-id: http://core.svn.wordpress.org/trunk@36693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 09:23:25 +00:00
Dominik Schilling
e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Drew Jaynes
4c3c2b315f Posts: Rename the $args parameter in get_post_types_by_support() to $feature for better self-documentation.
See #34010. See #32246.

Built from https://develop.svn.wordpress.org/trunk@36704


git-svn-id: http://core.svn.wordpress.org/trunk@36671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 04:55:25 +00:00
Pascal Birchler
8725644d40 Posts: Introduce get_post_types_by_support().
Similar to `get_post_types()`, this new function returns a list of post type names that support a specific feature.

Props wpsmith, barryceelen, swissspidy.
Fixes #34010.
Built from https://develop.svn.wordpress.org/trunk@36652


git-svn-id: http://core.svn.wordpress.org/trunk@36619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 22:50:26 +00:00
Eric Lewis
04da8bb63a Posts: Non-trashed posts should take slug priority over trashed posts.
When determining a unique post slug, trashed posts are taken into account. Previously, new posts would add suffixes to their slugs (e.g. `about-2`) when a post in the trash had the desired slug (e.g. `about`). 

To avoid this behavior, when a post is trashed its slug (i.e. `post_name`) is now suffixed with `-%trashed%`. The post's pre-trash slug is stored as post meta, and if the post is restored from trash, its desired slug is reapplied. 

For existing trashed posts which don't have the `-%trashed%` suffix, the suffix is added when a post with its desired slug is created.

Props ocean90, boonebgorges, ryan, SergeyBiryukov, coffee2code, helen, williamsba1.
See #11863.

Built from https://develop.svn.wordpress.org/trunk@36607


git-svn-id: http://core.svn.wordpress.org/trunk@36574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-21 21:45:28 +00:00
Andrew Ozz
2d94e025a2 Replace wp_upload_dir() with the new wp_get_upload_dir() in all cases where a file is not being uploaded. Deprecate _wp_upload_dir_baseurl(), and replace it with wp_get_upload_dir().
See #34359.
Built from https://develop.svn.wordpress.org/trunk@36569


git-svn-id: http://core.svn.wordpress.org/trunk@36536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 00:24:27 +00:00
Boone Gorges
571e14f897 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.
Built from https://develop.svn.wordpress.org/trunk@36566


git-svn-id: http://core.svn.wordpress.org/trunk@36533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 22:58:26 +00:00
Drew Jaynes
c55f447ad4 Docs: Revert unintended changes in wp-includes/post.php, mistakenly included in [36497].
See #34988. See #33701. 

Built from https://develop.svn.wordpress.org/trunk@36498


git-svn-id: http://core.svn.wordpress.org/trunk@36465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 02:46:25 +00:00
Drew Jaynes
3785385ea2 Docs: Add a missing version to the file header for wp-admin/term.php, introduced in [36308].
See #34988. See #33701.

Built from https://develop.svn.wordpress.org/trunk@36497


git-svn-id: http://core.svn.wordpress.org/trunk@36464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 02:43:26 +00:00
Boone Gorges
8db393ada6 Make the $post param optional in get_post_field().
When `$post` is `null`, the current post object will be returned.

Props sebastian.pisula.
Fixes #35683.
Built from https://develop.svn.wordpress.org/trunk@36481


git-svn-id: http://core.svn.wordpress.org/trunk@36448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-05 18:58:25 +00:00
Boone Gorges
de9d742b9a Allow is_post_type_viewable() to accept a post type name.
Previously, it accepted only a post type object.

Props spacedmonkey.
Fixes #35609.
Built from https://develop.svn.wordpress.org/trunk@36402


git-svn-id: http://core.svn.wordpress.org/trunk@36369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-26 02:37:26 +00:00
Pascal Birchler
68f12521c8 Post Types: Introduce unregister_post_type().
This new function can be used to completely unregister non built-in post types.

Fixes #14761.
Built from https://develop.svn.wordpress.org/trunk@36316


git-svn-id: http://core.svn.wordpress.org/trunk@36283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 12:20:27 +00:00
Pascal Birchler
b0b13aff2f Embeds: Allow embedding static front pages and pages having a child page with an embed slug.
This makes `embed` a special slug that can't be used for new pages/posts. When `https://example.com/foo/embed/` is an existing page, embeds fall back to `https://example.com/foo/?embed=true`.
Adds unit tests.

Fixes #34971.
Built from https://develop.svn.wordpress.org/trunk@36307


git-svn-id: http://core.svn.wordpress.org/trunk@36274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 07:56:26 +00:00
Pascal Birchler
d0c1f44d21 Docs: Revert [36268] as the global is indeed used, just via the superglobal.
Fixes #35413.
Built from https://develop.svn.wordpress.org/trunk@36269


git-svn-id: http://core.svn.wordpress.org/trunk@36236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-12 12:26:27 +00:00
Pascal Birchler
14f073a154 Docs: Fix incorrect DocBlock for wp_get_attachment_url().
The documented `$pagenow` global isn't used in the function.

Props sebastian.pisula.
Fixes #35413.
Built from https://develop.svn.wordpress.org/trunk@36268


git-svn-id: http://core.svn.wordpress.org/trunk@36235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-12 12:08:26 +00:00
Pascal Birchler
73317a33b6 Permalinks: Ensure the page hierarchy is correct for sample permalinks.
Fixes #35368.
Built from https://develop.svn.wordpress.org/trunk@36253


git-svn-id: http://core.svn.wordpress.org/trunk@36220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-10 18:28:28 +00:00
Sergey Biryukov
267c524a07 Docs: Correct get_page_uri() description.
Props ericlewis.
Fixes #35165.
Built from https://develop.svn.wordpress.org/trunk@36143


git-svn-id: http://core.svn.wordpress.org/trunk@36109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-01 18:29:27 +00:00
Andrew Ozz
597bbf0318 Responsive images: add compatibility for versions < 2.7 when the full image path was stored in the metadata. Introduces _wp_get_attachment_relative_path() and uses it in wp_get_attachment_url().
Props dd32, SergeyBiryukov.
Fixes #35106 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36120


git-svn-id: http://core.svn.wordpress.org/trunk@36086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-30 00:06:28 +00:00
Dion Hulse
d5d401ad10 Pages: get_page_uri() should return the URI at which the resource being accessed is available at, this may include non-'publish' status posts.
Reverts [34001] and fixes the original issue in #15963 - avoiding a PHP Notice for when the post doesn't exist.

Props tharsheblows.
See #15963.
Fixes #35084.

Built from https://develop.svn.wordpress.org/trunk@36094


git-svn-id: http://core.svn.wordpress.org/trunk@36059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-26 03:46:28 +00:00
Sergey Biryukov
7d9d7f2df4 Docs: Clarify that get_post_types() accepts 'not' as its $operator parameter.
Props barryceelen.
Fixes #35225.
Built from https://develop.svn.wordpress.org/trunk@36091


git-svn-id: http://core.svn.wordpress.org/trunk@36056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-26 00:38:25 +00:00
John Blackbourn
1402c3d8b4 Docs: Miscellaneous docblock corrections.
See #32246

Built from https://develop.svn.wordpress.org/trunk@36069


git-svn-id: http://core.svn.wordpress.org/trunk@36034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 06:31:27 +00:00
Sergey Biryukov
d5d5d64e3d I18N: Use better context for post statuses.
See #35054.
Built from https://develop.svn.wordpress.org/trunk@35903


git-svn-id: http://core.svn.wordpress.org/trunk@35867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-13 19:18:26 +00:00
Drew Jaynes
2cad8ec9e3 Docs: Remove indentation from a wrapped line in the DocBlock description for get_post_type_labels() to prevent incorrect formatting when parsed.
With the false indentation in place, the parser for the Code Reference incorrectly interprets it as a block quote.

Fixes #35019.

Built from https://develop.svn.wordpress.org/trunk@35868


git-svn-id: http://core.svn.wordpress.org/trunk@35832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-11 18:42:27 +00:00
Eric Lewis
6be07725fb Add inline documentation for get_page_by_path().
Fixes #34964.

Built from https://develop.svn.wordpress.org/trunk@35861


git-svn-id: http://core.svn.wordpress.org/trunk@35825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-11 03:50:26 +00:00
Joe Hoyle
5031ca5c23 Prevent unnecessary $wpdb->update() when hierarchical post doesn't have children.
Props danielbachhuber.
Fixes #34896.

Built from https://develop.svn.wordpress.org/trunk@35817


git-svn-id: http://core.svn.wordpress.org/trunk@35781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-07 17:47:25 +00:00
Eric Lewis
0e8e5124c1 Posts: Don't modify post_name if it wasn't supplied to wp_insert_post().
Previously when updating a post using wp_insert_post(), post_name was 
regenerated based on post_title every time if post_name was not passed in 
explicitly. This irons out the expectation that properties not passed into the 
function should not be modified.

Props jason_the_adams. 
Fixes #34865.

Built from https://develop.svn.wordpress.org/trunk@35800


git-svn-id: http://core.svn.wordpress.org/trunk@35764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:58:25 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

Built from https://develop.svn.wordpress.org/trunk@35718


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
Drew Jaynes
6069a4b2f6 Docs: Clarify the file header summary for wp-includes/post.php, the top-level file for the Post API.
See #33413. See #33701.

Built from https://develop.svn.wordpress.org/trunk@34401


git-svn-id: http://core.svn.wordpress.org/trunk@34365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:13:26 +00:00
Scott Taylor
4cec121d0b Move Walker_Page and Walker_PageDropdown into their own files via svn cp. Remove them from post-template.php. Load them in post.php.
`post-template.php` loads after `post.php` in `wp-settings.php`. It could probably also be loaded in `post.php`, but avoiding that for the moment.

See #33413.

Built from https://develop.svn.wordpress.org/trunk@34109


git-svn-id: http://core.svn.wordpress.org/trunk@34077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 02:59:24 +00:00
Scott Taylor
cd99e0cfff Posts: move WP_Post into its own file. post.php loads the new files, so this is 100% BC if someone is loading post.php directly. New files created using svn cp.
Creates: 
`class-wp-post.php` 
`post-functions.php` 

`post.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

Built from https://develop.svn.wordpress.org/trunk@33759


git-svn-id: http://core.svn.wordpress.org/trunk@33727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 12:40:21 +00:00
Scott Taylor
ef87172270 foreach is a statement, not a function.
See #33491.

Built from https://develop.svn.wordpress.org/trunk@33734


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Scott Taylor
21c61251a2 With a few modifications in wp-admin/menu.php, we can eliminate the extra logic for Post and Page menu registration. Instead, they can just declare menu_position on post type registration.
Props scribu, wonderboymusic.
Fixes #16865.

Built from https://develop.svn.wordpress.org/trunk@33723


git-svn-id: http://core.svn.wordpress.org/trunk@33690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-24 21:19:24 +00:00