Commit Graph

1216 Commits

Author SHA1 Message Date
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
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
Scott Taylor 107d5b088d `page_template` should be annotated as `@property`, not `@property-read` in `WP_Post`. The property is set on an instance in `wp_insert_post()`
Props morganestes.
Fixes #32515.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 17:01:24 +00:00
John Blackbourn 02192cb53f Introduce `featured_image`, `set_featured_image`, `remove_featured_image`, and `use_featured_image` post type labels when registering a post type in order to override the 'Featured Image' text and its related phrases.
Props johnbillion, mordauk, valendesigns.
Fixes #19257.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 16:54:27 +00:00
Boone Gorges 9f0c6cbf8c Disallow post slugs that will result in permalinks that conflict with date archive URLs.
On certain permalink structures, a numeric post slug will result in a post
permalink that conflicts with a date archive URL. For example, with permastruct
`/%year%/%monthnum%/%postname%/`, a post published in May 2015 with slug
`'15'` will result in a URL (`/2015/05/15/`) that conflicts with the archive
for May 15, 2015.

To avoid this problem, `wp_unique_post_slug()` rejects a requested slug when it
would generate a conflict of this type. Thus, in our example, `'15'` would
become `'15-2'`.

Props valendesigns, boonebgorges, Denis-de-Bernardy, loushou.
See #5305.
Built from https://develop.svn.wordpress.org/trunk@32647


git-svn-id: http://core.svn.wordpress.org/trunk@32617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 12:53:24 +00:00
Scott Taylor 5ee54c05ac Add missing doc blocks to `revision.php`.
Clarify `@return` values where necessary.
In `wp_delete_post_revision()`, `wp_delete_post()` doesn't return `WP_Error`, so that check can be removed.
`wp_revisions_to_keep()` always returns an `int`, so `wp_revisions_enabled()` can use strict comparison.
 
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 18:38:24 +00:00
Scott Taylor 2ebce023df Add missing doc blocks to `post.php`.
Clarify some existing values for `@param` and `@return`.
Some functions do not need to set a variable before immediately returning it.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 17:05:26 +00:00
Scott Taylor af7a017f46 When calling `unset()`, it is unnecessary to immediately precede it with a call to `isset()`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:47:25 +00:00
Boone Gorges 9d54232e39 Streamline support for multiple post types in `get_posts_by_author_sql()`.
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document.
* Add changelog entries to all calling functions.

Props DrewAPicture.
Fixes #32243.
Built from https://develop.svn.wordpress.org/trunk@32524


git-svn-id: http://core.svn.wordpress.org/trunk@32494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 19:49:29 +00:00
Boone Gorges 67c935ad9c Support multiple post types in `count_user_posts()` and other functions that use `get_posts_by_author_sql()`.
Props nikonratm.
Fixes #32243.
Built from https://develop.svn.wordpress.org/trunk@32523


git-svn-id: http://core.svn.wordpress.org/trunk@32493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 18:43:27 +00:00
Boone Gorges 4cdf05f6bc Improve performance of `get_page_children()`.
The new algorithm uses a hash table rather than function recursion, reducing
complexity to O(N). On large numbers of pages, the performance improvement is
several orders of magnitude.

Props santagada, hailin, mihai.
Fixes #10852.
Built from https://develop.svn.wordpress.org/trunk@32355


git-svn-id: http://core.svn.wordpress.org/trunk@32326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 19:37:53 +00:00
Drew Jaynes cbd07f213d Add two changelog entries for functional changes introduced in 4.2.0.
Props dimadin.
See #31925.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 02:16:25 +00:00
Boone Gorges e59aaa4f67 Attachment URLs should only be forced to SSL on the front end.
Detecting SSL status on the Dashboard introduces problems when writing content
that is saved to the database and then displayed on the front end, where SSL
may be optional (or impossible, due to self-signed certificates). The new
approach parallels the logic in `get_home_url()` for forcing HTTPS.

See [31614] #15928 for background.

Fixes #32112 for trunk.
Built from https://develop.svn.wordpress.org/trunk@32342


git-svn-id: http://core.svn.wordpress.org/trunk@32313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-04 13:10:27 +00:00
Dominik Schilling 64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Scott Taylor bce851dcf2 Replace `array_shift()` with `reset()` where appropriate for performance.
Props SergeyBiryukov.
Fixes #31259.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-19 03:56:27 +00:00
Drew Jaynes f50307c5d8 Clean up some inline documentation for emoji functionality, including a missing `@since` for `mail_emoji()`, and a changelog entry for `wp_insert_post()`.
See #31242.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-16 01:43:28 +00:00
Gary Pendergast 46e2a65cf1 Add emoji support, with Twemoji fallback.
Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.

Props batmoo, joen and mkaz for the original plugin upon which this is based.

Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.

See #31242


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


git-svn-id: http://core.svn.wordpress.org/trunk@31714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 22:49:28 +00:00
Drew Jaynes b1a59e9d30 Add a missing `@since 4.2.0` tag to the DocBlock for `wp_attachment_is()`.
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 07:12:28 +00:00
Drew Jaynes b84904051b Better document parameters and the return for the newly-introduced `wp_attachment_is()`.
Also adds a changelog entry to the DocBlock for `wp_attachment_is_image()` to denote that it serves as a wrapper for `wp_attachment_is()` as of 4.2.0.

See [31645]. See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 07:09:28 +00:00
Boone Gorges b421255fc8 When passing `$full` to `get_posts_by_author_sql()`, make sure a 'post_type' clause is included in results.
This change makes the 'post_type' clause in `wp_list_authors()` redundant, so
we remove it. Third-party plugins using `get_posts_by_author_sql()` may have
similarly redundant clauses, but this won't change the results returned by the
SQL queries.

Also adds unit tests for `get_posts_by_author_sql()`.

Props pbearne.
Fixes #30354.
Built from https://develop.svn.wordpress.org/trunk@31653


git-svn-id: http://core.svn.wordpress.org/trunk@31634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 01:15:28 +00:00
Scott Taylor 70aec9e406 Add unit tests for `wp_attachment_is()`, checks the whitelist and arbitrary extension.
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:38:26 +00:00
Scott Taylor aabe0bcc2c After [31645], for the `default` `case`, return the result of checking the extension against the passed type.
See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:28:26 +00:00
Scott Taylor 8f0b626d13 Introduce a function, `wp_attachment_is( $type, $post = 0 )`, to collapse the logic for determining whether an attachment is an `image`, `audio`, or `video`.
This is admittedly a first pass. There needs to be a generic handler for when any other type is passed, but for now it accepts the whitelist.

See #25275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:26:26 +00:00
Boone Gorges 8c48f9400e In `wp_get_attachment_url()`, convert to HTTPS when possible.
`wp_get_attachment_url()`, via `wp_upload_dir()`, uses 'siteurl' to generate
attachment URLs. When a site is SSL-optional on the front end - ie, 'siteurl'
is non-HTTPS, but SSL is available - a number of situations can arise where
non-HTTPS attachment URLs cause browser mixed-content warnings:

a) SSL is forced in the admin and `wp_get_attachment_url()` is used to generate the `<img>` tag for an inserted image. In these cases, the post content will contain non-HTTPS. Viewing/editing this post in the Dashboard will result in non-HTTPS images being served in an SSL environment.
b) `wp_get_attachment_url()` is used in a theme to generate an `<img>` `src` attribute on a public page. When viewing that page over SSL, the images will have HTTP URLs.

This changeset switches attachment URLs to HTTPS when it's determined that the
host supports SSL. This happens when 'siteurl' is non-SSL, but the current page
request *is* over SSL, and the host of the current request matches the host of
the URL being generated.

Props joemcgill, boonebgorges.
Fixes #15928.
Built from https://develop.svn.wordpress.org/trunk@31614


git-svn-id: http://core.svn.wordpress.org/trunk@31595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 02:39:24 +00:00
Scott Taylor f6b1b01ecd Make a new function, `wp_delete_file()`. Use it.
Props scribu, wonderboymusic.
Fixes #17864.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 16:51:25 +00:00
Sergey Biryukov 224cb89878 Remove a stray single quote in `wp_insert_post()` documentation.
see #31359.
Built from https://develop.svn.wordpress.org/trunk@31496


git-svn-id: http://core.svn.wordpress.org/trunk@31477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-22 09:50:25 +00:00
Drew Jaynes 1ffca1fcb6 Clarify and complete default argument documentation for `wp_insert_post()`.
Props atimmer, SergeyBiryukov.
Fixes #31359.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-22 00:56:29 +00:00
Drew Jaynes 542a4bd98b Update the descriptions for `transition_post_status()` and the `{$new_stats}_{$post->post_type}` hook with more information about the expected behavior of transitioning post statuses.
In some cases, the values of `$old_status` and `$new_status` may be the same thing before and after a post status is "transitioned". An example of this would be the scenario where a published post is being updated: the status before and after the update both equal 'publish'.

Further, the documentation clarifies that if the intent is to only execute code when initially transitioningto a post status from something else, the 'transition_post_status' hook should be used instead of one of the dynamic hooks to avoid confusion.

Props Idealien for the initial patch.
Fixes #31099.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-14 09:11:28 +00:00
John Blackbourn 7520057038 Return a `WP_Error` if an empty name is provided when registering a post type.
Fixes #31134
Props tyxla, MikeHansenMe

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


git-svn-id: http://core.svn.wordpress.org/trunk@31431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-13 16:43:26 +00:00
Scott Taylor fe6b5983df In PHP 5.0.0, `is_a()` became deprecated in favour of the `instanceof` operator. Calling `is_a()` would result in an `E_STRICT` warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Drew Jaynes 632c26d142 Remove an erroneous `@internal` tag from the DocBlock for `get_children()`.
Use of the `@internal` tag caused the reference article for this function to be skipped during the parsing process.

Fixes #30987 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 00:08:22 +00:00
Scott Taylor fc843ce4d0 There are some random `add_action()` and `add_filter()` calls littered around some files in `wp-includes/`. These should be moved to `wp-includes/default-filters.php` with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even `SHORTINIT` - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Scott Taylor 806b2e9bae `get_post()` takes `$output` as its 2nd param. The `@return` annotation should reflect the function's ability to return an array.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 21:38:23 +00:00
Scott Taylor 5547115dc2 Fix some `@param` docs that have chars too close them.
Add `@property` annotations to `WP_User` and `WP_Post`.
Remove erroneous `@param`s from image editor class methods.
Officially add the property `$_column_headers` to `WP_List_Table`.	

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:57:22 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Sergey Biryukov 7685e9dc97 Skip building the query in wp_count_posts() if cached results are used.
props MikeHansenMe.
fixes #30928.
Built from https://develop.svn.wordpress.org/trunk@31058


git-svn-id: http://core.svn.wordpress.org/trunk@31039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-06 16:58:26 +00:00
Scott Taylor f79eb196df Improve the handling of comma-separated mime-types in `wp_match_mime_types()`, particularly as pertains to the mime-type selector on the Media list table screen.
Props mdgl.
Fixes #30788.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-04 02:32:22 +00:00
Scott Taylor aa26b4c1a0 If you set `'_wp_page_template'` for a post, and then switch to a theme that doesn't support the template, subsequent calls to `wp_insert_post()` will bail early without running a plethora of hooks. This shouldn't happen. We should set the template to `'default'` and continue through the rest of the function. The function will still bail if `$wp_error` is `true` via `wp_insert_post( $arr, true )`.
Props nofearinc.
Fixes #25334.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-01 20:35:30 +00:00
Scott Taylor 5eb5afac34 For clarity, initialize some arrays that previously were only assigned via short circuit in loops.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 22:47:22 +00:00
Scott Taylor 48620242c4 Give up on making uninterrupted hierarchies work in `get_page_children()` for now, reverts [30159], [30246], [30636].
Props boonebgorges.
See #14477.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-04 00:24:22 +00:00
Drew Jaynes ad1f226c35 Improve formatting of inline documentation for `get_pages()`.
Adds missing default values, corrects several argument types, backtick-escapes argument names used in descriptions.

See #28298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-03 10:31:23 +00:00
Drew Jaynes 68ed7af808 Use the correct hash notation syntax for the `get_pages()` DocBlock.
See #28298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-03 10:16:23 +00:00
Scott Taylor 9a8be964b6 Improve the `@param` docs for `src/wp-includes/post*.php`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:37:22 +00:00
Drew Jaynes 7e532924c3 Docs Formatting: Backtick-escape inline code for all dynamic hook docs in wp-includes/post.php.
Affects DocBlocks for the following hooks:
* `post_type_labels_{$post_type}`
* `edit_{$field}`
* `{$field_no_prefix}_edit_pre`
* `pre_{$field}`
* `{$field_no_prefix}_save_pre`
* `{$field}_pre`
* `$field`
* `save_post_{$post->post_type}`
* `{$old_status}_to_{$new_status}`
* `{$new_status}_{$post->post_type}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 11:56:22 +00:00
Scott Taylor d12eb2e38e Ensure uniqueness when returning page lists in `get_page_children()`. Fixes failing unit tests.
Props boonebgorges.
Reverts [30246].
Fixes #14477.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 06:05:24 +00:00
John Blackbourn db9b25fbc5 Check attachments as well as the current post type when checking for duplicate post slugs. This avoids creating a page with a slug which conflicts with an existing attachment (the inverse is already handled).
Updates the existing test for pages which should take priority over attachments in cases where an existing clash exists.

Fixes #18962
Props boonebgorges

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


git-svn-id: http://core.svn.wordpress.org/trunk@30619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 04:49:22 +00:00
Drew Jaynes 3b6c9519a8 Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape HTML tags in several argument descriptions for `wp_link_pages()`
* Remove an HTML tag from the summary for `prepend_attachment()`
* Backtick-escape inline code in the description for `get_extended()`
* Backtick-escape inline code in the description for `get_post_type_labels()`
* Various markdown formatting in the description for `add_rewrite_endpoint()`
* Markdown-indent a code snippet in the file header for wp-includes/shortcodes.php
* Markdown-indent code snippets in the description for `add_shortcode()

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 06:15:24 +00:00
John Blackbourn b50cbe1f4f Correct an SQL syntax error introduced in r30158. Adds tests.
Fixes #30339
See #18962
Props julien731

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


git-svn-id: http://core.svn.wordpress.org/trunk@30468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 16:46:22 +00:00
Drew Jaynes 3e94d3a931 Fix incorrect documentation in the DocBlocks for `get_lastpostmodified()` and `_get_last_post_time()`.
Props ericlewis for the initial patch.
Fixes #30249.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 21:08:45 +00:00
Drew Jaynes 92c153aa8c Fix the syntax for some status-related documentation introduced in [30155].
* Variables in DocBlocks should be backtick-escaped
* Parameter and return types should be as specific as possible
* `@param` types and variables should align with each other, but not intentionally with the `@return` description

See #30230.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:56:22 +00:00
Scott Taylor 03ea739661 In `get_page_children()`, only check `$page->ancestors` once to avoid duplicates when the function recurses. Adds an argument, `$ancestors`.
Fixes #18962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 20:05:24 +00:00
Scott Taylor 878d074e84 Allow `get_pages()`, with `child_of` passed to it, to work with interrupted hierarchies.
Adds unit test.
Fixes #18962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:44:21 +00:00
Scott Taylor d5e4583475 All duplicate slugs across different post types.
Adds unit test.

Props mboynes, nacin.
Fixes #18962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:37:24 +00:00
Scott Taylor be08f576df Improve some `post_status`-related documentation.
Props ericlewis.
See #30230.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 20:20:23 +00:00
Drew Jaynes 66c47f29bb Correct references of `@uses $wpdb` in core documentation to use `@global`.
See #30191, [30105].
Fixes #30217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes f8657d5890 Remove redundant and erroneous `@uses` tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Sergey Biryukov 64d1fd2a8f When using 'show_in_menu' as a default value for 'show_in_admin_bar' in register_post_type(), cast to boolean instead of requiring a strict match.
props ipm-frommen.
fixes #30092.
Built from https://develop.svn.wordpress.org/trunk@30041


git-svn-id: http://core.svn.wordpress.org/trunk@30041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-27 13:08:19 +00:00
Scott Taylor fd4e3023d6 In `wp_delete_attachment()`: account for orphan sizes by looping over the sizes stored in metadata, instead of relying on the current sizes stored in `$_wp_additional_image_sizes`.
Props JoshuaAbenazer, desrosj, markoheijnen.
Fixes #24518.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 15:32:16 +00:00
Drew Jaynes cca3890c84 Add some missing information to the inline docs for `get_post_types()`.
* Improves the `@see` reference for `register_post_type()` to mention that it contains information about accepted arguments
* Adds a description of the accepted values for the `$operator` parameter
* Fixes a typo

Fixes #29721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-21 08:55:18 +00:00
Sergey Biryukov 793f814303 Make sure the $parent argument of wp_insert_attachment() still works as expected after [28579].
prop jesin, dikiy_forester.
fixes #29646 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29745


git-svn-id: http://core.svn.wordpress.org/trunk@29519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-15 14:24:17 +00:00
John Blackbourn d5156105b3 Correct the docblock for the `registered_post_type` action. Fixes #29184.
Built from https://develop.svn.wordpress.org/trunk@29468


git-svn-id: http://core.svn.wordpress.org/trunk@29246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-11 21:21:16 +00:00
Scott Taylor 0fbddaa2d2 Unbreak `Media Trash` after [28788].
Props SergeyBiryukov.
Fixes #29080.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-01 15:15:17 +00:00
Sergey Biryukov 9c1d22a454 Avoid PHP notices in _count_posts_cache_key(), _update_blog_date_on_post_publish(), and _update_blog_date_on_post_delete() if post type is not registered.
props jesin.
fixes #28135.
Built from https://develop.svn.wordpress.org/trunk@29318


git-svn-id: http://core.svn.wordpress.org/trunk@29099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-29 00:51:17 +00:00
Drew Jaynes 29f48882c8 Convert default arguments documentation for `get_posts()` into a hash notation.
Props coffee2code for the initial patch.
See #28841.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 23:34:15 +00:00
Drew Jaynes 61d1ecba20 Fix syntax for inline comment line endings and a few line wraps in wp-includes/post.php inline documentation.
Fixes #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 18:35:16 +00:00
Drew Jaynes 47bdd8cbd0 General inline documentation improvements in wp-includes/post.php.
Final-run. Fixes #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 11:16:15 +00:00
Drew Jaynes 877bbff728 General inline documentation improvements in wp-includes/post.php.
Third-run. See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 10:28:15 +00:00
Drew Jaynes f820bb9fa3 General inline documentation improvements in wp-includes/post.php.
Second-run. See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 08:16:14 +00:00
Drew Jaynes 789960f242 Convert phpDoc for `register_post_type()` to use a hash notation for the `$args` array.
See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 07:56:14 +00:00
Drew Jaynes 4cf4a6b866 General inline documentation improvements in wp-includes/post.php.
First-run. See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 07:01:14 +00:00
Drew Jaynes d4dd02b4ae Remove backticks on `$post` variables in some short parameter descriptions.
See [28653], [28654].
See #28388.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 19:28:14 +00:00
Drew Jaynes 6dd339f215 Specify the `$single` parameter default for `get_post_meta()`. Docs spacing.
See #28708.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 03:30:14 +00:00
Sergey Biryukov 81103f482a Mark $single parameter of get_post_meta() as optional.
props netweb.
fixes #28708.
Built from https://develop.svn.wordpress.org/trunk@28954


git-svn-id: http://core.svn.wordpress.org/trunk@28750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 03:26:16 +00:00
Sergey Biryukov a8d0832a15 Notify developers when register_post_type() or register_taxonomy() fails because of post type or taxonomy key length.
props mattheweppelsheimer.
fixes #28683.
Built from https://develop.svn.wordpress.org/trunk@28902


git-svn-id: http://core.svn.wordpress.org/trunk@28701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 21:54:14 +00:00
Scott Taylor 8b3bb6cc2d Remove obsolete `wp_cache_delete('get_pages', 'posts')` from `clean_post_cache()`.
Fixes #27459.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 02:16:14 +00:00
Scott Taylor 269bd96f65 Posts in the Trash should not drag attachment pages down with them.
Props ericlewis.
Fixes #14639.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-20 19:14:15 +00:00
Scott Taylor 33c096aa71 Reinstate the changes from [28579] with some adjustments:
* Check `! empty( $postarr['file'] )` before calling `update_attached_file()`
* Add a unit test: `test_update_attachment_fields()`
* Run the same logic for empty `guid` for attachments that always ran in `wp_insert_post()`, as per #18310. This fixes a unit test that would have broken when this ticket was marked closed.
* Updated the unit test in `Tests_Media::test_wp_prepare_attachment_for_js()` to account for `url` no longer being empty

Props kovshenin, wonderboymusic.
See #21963.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-20 18:27:14 +00:00
Scott Taylor 05eeb16e30 Replace all uses of `like_escape()` with `$wpdb->esc_like()`.
Props miqrogroove.
See #10041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Sergey Biryukov f9792ed973 Correct @return value for get_children().
props ghost1227.
fixes #28422.
Built from https://develop.svn.wordpress.org/trunk@28677


git-svn-id: http://core.svn.wordpress.org/trunk@28495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 15:53:14 +00:00
Drew Jaynes b0a1f67b6b Be more specific that `$post_id` does not default to the ID of the global `$post` in some cases.
See [28654]. See #28388.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-03 04:52:15 +00:00
Drew Jaynes 3724252959 Ensure `$post_id` is documented as optional where applicable.
See #28388.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-03 04:44:16 +00:00
Andrew Nacin 3a2174002e Revert [28579] and [28582]. see #21963.
Built from https://develop.svn.wordpress.org/trunk@28601


git-svn-id: http://core.svn.wordpress.org/trunk@28426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-28 18:14:15 +00:00
Scott Taylor 714aae91ea Fix some inline docs churn in `wp_insert_post()` after [28579].
Props kpdesign.
See #21963.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-27 00:24:15 +00:00
Scott Taylor b184336927 Combine `wp_insert_attachment()` and `wp_insert_post()`. `wp_insert_attachment()` becomes a wrapper. Update inline docs.
Props wonderboymusic, DrewAPicture.
See #21963.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-26 23:20:13 +00:00
Scott Taylor 8d4d645629 Fix parsing in `wp_match_mime_types()` to allow some mime-types with `+` in them to appear in the list of filter links shown above the list table on `upload.php`.
Props _duck.
Fixes #20672.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-22 21:36:15 +00:00
Scott Taylor f4661c6659 Eliminate the use of `extract()` in `get_pages()`.
See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 17:12:15 +00:00
Scott Taylor 1bd4118799 Eliminate the use of `extract()` in `wp_insert_attachment()`.
`wp_insert_attachment()` and `wp_insert_post()` are incredibly similar, but have branched logic. I have annotated many places where they diverge.

See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 16:54:14 +00:00
Scott Taylor 73a9ba7428 Eliminate the use of `extract()` in `wp_insert_post()`.
See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 15:53:15 +00:00
Scott Taylor ef8b813682 Eliminate use of `extract()` in `trackback_url_list()`.
See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-13 04:44:15 +00:00
Scott Taylor 1aed1f1108 In `get_pages()`, `$cache` does not need to be reset to an empty array. `update_post_cache( $pages )` takes care of priming.
In `set_post_thumbnail()`, (accidental) assignment is unnecessary for `$thumbnail_html` as it is not used. 

See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 21:39:14 +00:00
John Blackbourn ab041987d3 Remove some unnecessary abstraction introduced in [28191]. See #27985.
Built from https://develop.svn.wordpress.org/trunk@28194


git-svn-id: http://core.svn.wordpress.org/trunk@28024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-24 11:55:22 +00:00
John Blackbourn d6e03df3c9 Avoid an expensive attachment counting query on the post editing screen. See #27985, for trunk.
Built from https://develop.svn.wordpress.org/trunk@28191


git-svn-id: http://core.svn.wordpress.org/trunk@28021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-23 22:05:16 +00:00
Drew Jaynes 2d79af0e0a Part II of inline documentation for hooks in wp-includes/post.php.
Documents all remaining hooks following [28041] and [28042]. Also updates the hash notation style for `wp_insert_post()`.

Props nacin for several hook descriptions.

Fixes #25376.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-13 23:06:14 +00:00
Drew Jaynes a55d734f60 Clarify documentation for hooks in `sanitize_post_field()`.
* `edit_post_{$field}` pairs with `edit_{$field}`
* `pre_post_{$field}` pairs with `pre_{$field}`
* `post_{$field}` pairs with `{$field}`

As the above pairs' docs are unnecessarily duplicative, the second sets of docs have been removed. Also, the "duplicates" are purposely not marked as such in this case as the hook names differ. Also remove `@deprecated` tags mistakenly left in in [28041].

See #25376.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-08 07:41:14 +00:00
Drew Jaynes 07ee43d6d0 Part I of inline documenation for hooks in wp-includes/post.php.
Adds docs for the following hooks:
* `get_attached_file`
* `update_attached_file`
* `_wp_relative_upload_path`
* `post_type_labels_{$post_type}`
* `edit_{$field}`
* `{$field_no_prefix}_edit_pre`
* `edit_post_{$field}`
* `pre_{$field}`
* `{$field_no_prefix}_save_pre`
* `pre_post_{$field}`
* `{$field}_pre`
* `$field`
* `post_{$field}`
* `wp_count_posts`
* `wp_count_attachments`
* `post_mime_types`
* `wp_insert_post_empty_content`

See #25376.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-08 06:49:14 +00:00
Drew Jaynes cebbcd473c Fix the `wp_count_attachments()` PHPDoc to reflect that it returns an object, not array.
See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 05:43:15 +00:00
Scott Taylor 0a2e85d3f0 Use `wp_parse_id_list()` when parsing `exclude_tree` in `get_pages()`. Add unit tests to ensure a URL string, array with string as value, and array with array as value for `exclude_tree` can be used to specify multiple IDs.
Props cgaffga, roothorick, hakre, tbrams for patches across the years.
Fixes #9153.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 01:18:14 +00:00
Helen Hou-Sandí 52d2920891 Use Dashicon-style images for mime type icons. Actually moving to Dashicons via the font can be explored later, but has theme/plugin implications and requires too many changes to make it for 3.9. props melchoyce for the icons. fixes #26650.
Built from https://develop.svn.wordpress.org/trunk@27726


git-svn-id: http://core.svn.wordpress.org/trunk@27563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 21:10:15 +00:00
Scott Taylor 38d1fb971f Turn on thumbnail support for `attachment:audio` and `attachment:video`. Change conditionals to check for theme OR post type support when determining whether to turn on the Featured Image UI pieces in the admin.
Fixes #27460.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-23 02:35:14 +00:00
Drew Jaynes da19fc531c Better standardize parameter value types in PHPDocs where both a post ID or `WP_Post` would be acceptable.
Covers cases where previously only `int` or `int|object` types were notated.

Props coffee2code for the original patch.
See #20495.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 19:32:16 +00:00
Andrew Nacin 17ccbc86c9 Rename the new page_templates filter to theme_page_templates, and pass it a post object for proper context.
see #13265.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 04:19:16 +00:00
John Blackbourn 3a0a98205c Allow `get_page_by_path()` and `get_page_by_title()` to accept an array of post types. Fixes #24763. Props zbtirrell.
Built from https://develop.svn.wordpress.org/trunk@27423


git-svn-id: http://core.svn.wordpress.org/trunk@27270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 22:26:15 +00:00
Andrew Nacin d24a109288 Revert [27115] and let cache backends handle the stripping of spaces in cache keys as necessary.
microtime() returns greater precision than microtime(true).

see #27000, #23448, #26903, #14485.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 22:05:13 +00:00
Drew Jaynes cb8951b0b3 Remove all `@package` and `@subpackage` PHPDoc tags not at the file- or class-levels in core.
See #27200.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Sergey Biryukov ab8847316c Correct return values for update_metadata() and related functions.
fixes #21864.
Built from https://develop.svn.wordpress.org/trunk@27191


git-svn-id: http://core.svn.wordpress.org/trunk@27050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-18 21:36:14 +00:00
Drew Jaynes 8c9f7965af Inline documentation for the `wp_insert_attachment_data` filter hook, added in [27130].
Fixes #20547.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-08 22:47:12 +00:00
Scott Taylor cbc1b90633 Add a filter `wp_insert_attachment_data` in `wp_insert_attachment()`. This is similar to the `wp_insert_post_data` filter in `wp_insert_post()`.
Fixes #20547.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-08 00:44:13 +00:00
Andrew Nacin 084a7b50cd Use a float for last_changed microtime cache values.
microtime() by default returns a string with a space, which isn't allowed for keys in some cache backends.

props _jameslee, drozdz.
fixes #27000. see #23448.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 08:14:12 +00:00
Scott Taylor 4830eeb9ad Properly invalidate the cache for `wp_count_posts()` on insert, trash, or when transitioning `post_status` inside of `_transition_post_status()`. Introduces `_count_posts_cache_key()`. Adds unit tests.
Props mark8barnes, for bringing this to our attention in an initial patch.
Fixes #21879.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-03 19:42:13 +00:00
Drew Jaynes edce7b88b5 Improve inline documentation for `add_post_type_support()`.
Props philiparthurmoore.
Fixes #26683.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-07 02:05:11 +00:00
Sergey Biryukov 0ddaa76f3e Use correct example of a Dashicons helper class in add_menu_page() and register_post_type() docs.
props Rarst.
fixes #26617 for trunk.
Built from https://develop.svn.wordpress.org/trunk@26884


git-svn-id: http://core.svn.wordpress.org/trunk@26767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-31 10:33:11 +00:00
Andrew Nacin 9b29ad0529 Allow for Dashicons and base64-encoded data:image/svg+xml URIs when specifying menu icons.
Both of these icons can be colored to match the color scheme, including hover states.
Both are accepted for register_post_type()'s menu_icon argument, and also add_menu_page()'s $icon_url argument.

To use a Dashicon, pass the name of the helper class, e.g. 'dashicons-piechart'.
To use an SVG, pass a valid data URI string starting with 'data:image/svg+xml;base64,'.

props helen.
fixes #25147.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-05 06:38:09 +00:00
Andrew Nacin 6fa4ce2284 Return false from wp_delete_post() and wp_delete_attachment() if the DELETE is unsuccessful.
This prevents attachments from being deleted off disk when a DB is locked and the delete is otherwise unsuccessful.

fixes #25107.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 22:59:10 +00:00
Scott Taylor 295851d0bb In `get_posts()`, alter the doc block and default args to make `orderby` equal to `date`, not `post_date`.
Props ounziw.
Fixes #26128.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-22 17:39:10 +00:00
Andrew Nacin d0cfa40983 Add jshintrc to qunit.
props jorbin.
see #25187.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-30 14:39:10 +00:00
Andrew Nacin 5361a8abca Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:59:20 +00:00
Andrew Nacin 8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Andrew Nacin 74488bdcb0 Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 17:22:11 +00:00
Andrew Nacin 5b6bcb218d Reset "Page on Front" when such a page is trashed.
props danielbachhuber.
fixes #24171.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-03 03:51:09 +00:00
Dominik Schilling e4c8d56b76 Replace use of global `$user_ID` in favor of `get_current_user_id()`. fixes #25372.
Built from https://develop.svn.wordpress.org/trunk@25669


git-svn-id: http://core.svn.wordpress.org/trunk@25585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 21:10:09 +00:00
Scott Taylor 3f42db549c `post_content` does not have a default value in the `$wpdb->posts` table. Add a default value of empty string to `wp_insert_attachment()` to avoid a tornado of database errors in PHP 5.5/MySQL 5.6, even when debug mode is turned off.
See #25282.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 19:52:09 +00:00
Drew Jaynes 82904baffd Improve inline documentation for `wp_insert_post()` by adding a hash notation.
See #25412.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-25 17:34:08 +00:00
Drew Jaynes 38b7b3a1c5 Clarify inline documentation for the return in `get_attached_file()`.
Fixes #25409.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 21:29:08 +00:00
Andrew Nacin 71263c4854 Use correct variable. props helen. see #17071.
Built from https://develop.svn.wordpress.org/trunk@25581


git-svn-id: http://core.svn.wordpress.org/trunk@25498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 20:18:10 +00:00
Andrew Nacin 8fa6e99edc Introduce a wp_count_attachments filter.
props kevinB.
fixes #17071.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 19:11:09 +00:00
Andrew Nacin a4040ea928 In wp_count_posts(), rename 'count_posts' hook to 'wp_count_posts', for clarity. see #16603.
Built from https://develop.svn.wordpress.org/trunk@25578


git-svn-id: http://core.svn.wordpress.org/trunk@25495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 19:08:09 +00:00
Andrew Nacin 5febb6045f Introduce a meta_box_cb argument for register_taxonomy().
The specified callback function is used as the meta box callback for the taxonomy.

props garyc40, helen.
fixes #14206.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 17:12:10 +00:00
Scott Taylor 8697ae572e Add hooks to `wp_count_posts()`. Adds filter docs. Adds unit test to test `count_posts` filter.
Props nacin, DrewAPicture. 
Fixes #16603.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-21 17:55:08 +00:00
Scott Taylor ae4cf7665a Add `@access private` to `_get_custom_object_labels()`, which was already implied by the dangling underscore. Cast `$labels` to `array` in `get_taxonomy_labels()` and `_get_custom_object_labels()`.
Props nacin, foofy.
Fixes #16310.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-21 17:44:09 +00:00
Scott Taylor 8bd9659d0d Move checks for `post_type` being an array inline. See [25291], [25292], #18614.
Built from https://develop.svn.wordpress.org/trunk@25312


git-svn-id: http://core.svn.wordpress.org/trunk@25274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 03:02:10 +00:00
Scott Taylor d7704991b3 Check the value passed to `get_post_type_object()`. If it's an array, use the first item. `get_query_var( 'post_type' )` can be an array if the query has been altered via filters/actions. There are several places in core that pass the query var. Adds unit tests.
In `template-loader.php`, move `is_post_type_archive()` and `is_tax()` directly below `is_home()`.

See #18614, [25291].


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


git-svn-id: http://core.svn.wordpress.org/trunk@25256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 23:39:09 +00:00
Andrew Nacin 4b40e7a646 More adjustments and improvements for inline documentation for get_pages(). see #25186.
Built from https://develop.svn.wordpress.org/trunk@25271


git-svn-id: http://core.svn.wordpress.org/trunk@25237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 01:21:09 +00:00
Scott Taylor 54c5a75e68 Simplify the check for false-y `child_of` arg.
Props SergeyBiryukov.
See #25230, [25245].


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


git-svn-id: http://core.svn.wordpress.org/trunk@25236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 23:36:10 +00:00
Scott Taylor cc41e7d04a Fix spacing in docs for `get_pages()`.
Props DrewAPicture.
See #25186.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 23:21:10 +00:00
Scott Taylor 1855f97a2c Add docs to the woefully under-documented `get_pages()`.
Props DrewAPicture.
Fixes #25186.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 22:13:09 +00:00
Scott Taylor d1a40562eb Add check to make sure a valid argument was passed to `get_page_uri()`.
Props Viper007Bond.
Fixes #24491.



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


git-svn-id: http://core.svn.wordpress.org/trunk@25230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 21:42:10 +00:00
Scott Taylor 6253183ffc Set `hierarchical` to `false` when `parent` is passed to `get_pages()` and `child_of` is not.
Fixes #25230.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 21:00:09 +00:00
Scott Taylor bf6da40cfc Allow `get_pages()` to accept an `array` for the arg `parent`. Adds unit tests, some will fail until the next commit.
Fixes #9470.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 20:56:09 +00:00
Scott Taylor f1a33028f6 Allow `int` to be passed in lieu of `array`, add `append` arg to `wp_set_post_categories()`. Adds more extensive unit tests for `wp_set_post_categories()`.
Props ptahdunbar for initial patch.
Fixes #16550.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 17:42:10 +00:00
Jon Cave 93b2edbbba Correct rewrite tag for hierarchical post types without a query_var.
Hierarchical rewrite rules operate via the 'pagename' query variable which is
passed to get_page_by_path(). However, the current rewrite rules use the 'name'
query variable for hierarchical types without a custom query_var.

Fixes #16323.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-30 08:08:09 +00:00
Scott Taylor 7c1ea6c95c No need to re-map the return values of `wp_parse_id_list()` to int.
See #22074, #11823.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 18:54:09 +00:00
Scott Taylor 0624fe960b Improve the include / exclude SQL generation in `get_pages()` by using `IN` and `NOT IN` where applicable. Adds unit tests for include / exclude.
Fixes #22074.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 18:49:09 +00:00
Scott Taylor 8e6abf65a8 Respect the `fields` arg when passed to `get_children()`.
Fixes #22208.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 15:08:12 +00:00
Dominik Schilling 357f52eed7 Improve inline docs for register_post_type() and register_taxonomy().
* register_taxonomy: Use the same doc format for the associative array arg as used for register_post_type()
* register_taxonomy: Improve docs for _builtin, capabilities, hierarchical and rewrite args
* register_taxonomy: Use the same order in $defaults as in docblock
* register_taxonomy: Replace is_null with null ===, to be consistent
* register_post_type: Use the same order in $defaults as in docblock
* register_post_type: Improve docs for @uses and default fallbacks
And while we're on it: Whitespaces.

fixes #25150.
Built from https://develop.svn.wordpress.org/trunk@25130


git-svn-id: http://core.svn.wordpress.org/trunk@25110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 20:24:08 +00:00
Sergey Biryukov b86ea82b12 Fix typo in phpdoc. props jamescollins. fixes #25092.
Built from https://develop.svn.wordpress.org/trunk@25097


git-svn-id: http://core.svn.wordpress.org/trunk@25079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 23:48:09 +00:00
Andrew Nacin fa4c7a1feb PHPDoc for WP_Post properties. fixes #25092.
Built from https://develop.svn.wordpress.org/trunk@25086


git-svn-id: http://core.svn.wordpress.org/trunk@25070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 15:58:09 +00:00
Scott Taylor a9dc60c9a8 Improve inline docs for function params that can be serialized when non-scalar. Fixes #18488.
Built from https://develop.svn.wordpress.org/trunk@25076


git-svn-id: http://core.svn.wordpress.org/trunk@25061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-21 21:11:09 +00:00
Dominik Schilling 8ad024f30a Introduce save_post_{$post_type} hook.
The hook is fired before the general save_post hook and has the same args as save_post.

props bmb, SergeyBiryukov, ocean90, fixes #16176.
Built from https://develop.svn.wordpress.org/trunk@25050


git-svn-id: http://core.svn.wordpress.org/trunk@25037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-17 20:21:09 +00:00
Andrew Nacin 08c4061af7 In get_attached_file(), fix the explanation of when the filter is bypassed. props devesine, fixes #24571.
git-svn-id: http://core.svn.wordpress.org/trunk@24983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 22:07:42 +00:00
Andrew Nacin 487327cf4e Pass $update = true to the save_post and wp_insert_post hooks in wp_publish_post().
see #21450, [24823].

props wpsmith.
fixes #24957.


git-svn-id: http://core.svn.wordpress.org/trunk@24977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 21:41:51 +00:00
Andrew Nacin c95a24f2d9 When registering a post type, pass the correct argument for feeds to add_permastruct().
props butuzov, johnpbloch.
fixes #23302.



git-svn-id: http://core.svn.wordpress.org/trunk@24830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 22:28:18 +00:00
Andrew Nacin 87f9d112c0 Return an empty stdClass from wp_count_posts() when a nonexistent post type is requested.
props johnpbloch.
fixes #24803.



git-svn-id: http://core.svn.wordpress.org/trunk@24826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 21:38:00 +00:00