Commit Graph

966 Commits

Author SHA1 Message Date
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
Scott Taylor 4694c477d3 Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end

When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.

Custom post types with `public_queryable` set to `false` are not viewable on the front end. 
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.

This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:

`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`

If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.

I am in search of edge cases, so this shall land.

Props wonderboymusic, DrewAPicture.
See #17609.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 19:40:25 +00:00
Scott Taylor 0b29061b3d Fix case type in docs for `get_children()`.
Props bobbingwide.
Fixes #33364.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-18 21:39:24 +00:00
Boone Gorges 2f514a6115 When generating a fallback `post_name` using the post ID, `wp_insert_post()` should clear the post cache immediately.
If the post cache is not cleared at this point, the cache can become stale
for operations performed before the cache is cleared later in the function.
Specifically, the generation of a `guid` for new posts can use stale data,
resulting in non-unique values. [33262] introduced a call to `get_post()`
that introduced just such an invalidation problem.

Fixes #5305.
Built from https://develop.svn.wordpress.org/trunk@33630


git-svn-id: http://core.svn.wordpress.org/trunk@33597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-18 02:51:26 +00:00
Dominik Schilling 70128fe760 Comments: IDs are integers.
Built from https://develop.svn.wordpress.org/trunk@33555


git-svn-id: http://core.svn.wordpress.org/trunk@33522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-04 04:58:35 +00:00
Drew Jaynes 9cd32c7f6c Docs: Correct the possible return types and corresponding descriptions for `wp_get_post_terms()`.
Props adamkheckler for the initial patch.
Fixes #32950.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-23 07:45:25 +00:00
Boone Gorges 0a24f1bebf Improve function description for `wp_transition_post_status()`.
The documentation should make it clear that the function does not modify the
post object in the database, but only fires hooks related to the transition.

Props AramZS.
Fixes #33014.
Built from https://develop.svn.wordpress.org/trunk@33296


git-svn-id: http://core.svn.wordpress.org/trunk@33268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-16 14:35:26 +00:00
Boone Gorges 28ce0320e3 In `wp_unique_post_slug()`, only prevent date archive conflicts when the slug is being changed.
This prevents existing posts with numeric slugs from having their permalinks
changed on update.

Fixes #5305.
Built from https://develop.svn.wordpress.org/trunk@33262


git-svn-id: http://core.svn.wordpress.org/trunk@33234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 12:28:48 +00:00
Boone Gorges 5a1618b497 When creating a new post with an empty `post_name` and `post_title`, don't generate a `post_name` that conflicts with a date archive permalink.
See #5305.
Built from https://develop.svn.wordpress.org/trunk@33261


git-svn-id: http://core.svn.wordpress.org/trunk@33233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 12:28:24 +00:00
Drew Jaynes 9e94263af1 Wrap a long changelog entry description in the DocBlock for `get_post_type_labels()`.
See [32673]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:49:25 +00:00
Helen Hou-Sandí 30e478b1fb Move `get_default_comment_status()` to `wp-includes/comment.php` to sit alongside `get_comment_statuses()`.
props nacin.
see #31168.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-08 15:44:28 +00:00
Konstantin Obenland a4e803fbd4 Use `get_default_comment_status()` globally.
Also makes the filter name static and passes the post type for context.

Props valendesigns.
Fixes #31168.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-02 22:32:25 +00:00
Konstantin Obenland edffcb0bcd Turn of comments for pages by default.
Pages are static content, for which comments are not expected out of the box.

Props valendesigns, rachelbaker.
Fixes #31168.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-02 00:22:24 +00:00
Scott Taylor a28f09a32c Correct inline doc for `$public` in `register_post_status()`.
Props ericlewis.
Fixes #32061.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:35:25 +00:00
John Blackbourn f632756f16 Correct the docs for the `post_type_labels_{$post_type}` filter.
Fixes #32707
Props dlh

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


git-svn-id: http://core.svn.wordpress.org/trunk@32820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-18 21:33:27 +00:00
Scott Taylor 5c6b63d3a6 `if` is a statment, not a function.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 20:01:25 +00:00
Dominik Schilling 55f3b68c75 Nav Menus: Update `wp_setup_nav_menu_item()` to stop overriding empty properties from supplied `$menu_item`.
Update docs for `WP_Post` constructor to indicate that `WP_Post|object` can be the supplied param, as opposed to just `WP_Post`.

props westonruter.
fixes #32632.
Built from https://develop.svn.wordpress.org/trunk@32762


git-svn-id: http://core.svn.wordpress.org/trunk@32733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-14 10:53:25 +00:00