diff --git src/wp-includes/js/wp-api.js src/wp-includes/js/wp-api.js
index 3f950a47f5..cadddf5ee4 100644
|
|
|
|
| 466 | 466 | * Add a helper function to handle post Meta. |
| 467 | 467 | */ |
| 468 | 468 | MetaMixin = { |
| | 469 | |
| | 470 | /** |
| | 471 | * Get the meta for a post. |
| | 472 | * |
| | 473 | * @return {object} The post meta, as a key value pair object. |
| | 474 | */ |
| 469 | 475 | getMeta: function() { |
| 470 | | return buildCollectionGetter( this, 'PostMeta', 'https://api.w.org/meta' ); |
| 471 | | } |
| | 476 | return this.get( 'meta' ); |
| | 477 | }, |
| | 478 | |
| | 479 | /** |
| | 480 | * Set the meta for a post. |
| | 481 | * |
| | 482 | * @param {object} |
| | 483 | */ |
| | 484 | |
| | 485 | setMeta: function( meta ) { |
| | 486 | this.set( 'meta', meta ); |
| | 487 | }, |
| | 488 | |
| | 489 | |
| 472 | 490 | }, |
| 473 | 491 | |
| 474 | 492 | /** |
| … |
… |
|
| 699 | 717 | model = model.extend( CategoriesMixin ); |
| 700 | 718 | } |
| 701 | 719 | |
| 702 | | // Add the MetaMixin for models that support meta collections. |
| 703 | | if ( ! _.isUndefined( loadingObjects.collections[ modelClassName + 'Meta' ] ) ) { |
| | 720 | // Add the MetaMixin for models that support meta. |
| | 721 | if ( ! _.isUndefined( model.prototype.args.meta ) ) { |
| 704 | 722 | model = model.extend( MetaMixin ); |
| 705 | 723 | } |
| 706 | 724 | |