Commit 27a0d86
committed
Abilities API: Refine filtering and expose
Follow-up to [62420]. The `category` argument now takes a single slug, matching `namespace`; callers needing multiple values can use `item_include_callback`. This keeps the public surface simple and leaves room to accept arrays later without a break.
The list endpoint (`/wp-abilities/v1/abilities`) gains a `meta` query parameter alongside `category` and `namespace`. Conditions combine with AND logic, may be nested, and known annotations (`readonly`, `destructive`, `idempotent`) are coerced to booleans before matching. The endpoint always forces `meta[show_in_rest] => true`, so `meta` cannot reveal hidden abilities.
Props gziolo, jorgefilipecosta, apermo.
Fixes #64990.
git-svn-id: https://develop.svn.wordpress.org/trunk@62548 602fd350-edb4-49c9-b593-d223f7449a82meta over REST.1 parent 36cc6e9 commit 27a0d86
5 files changed
Lines changed: 337 additions & 16 deletions
File tree
- src/wp-includes
- rest-api/endpoints
- tests
- phpunit/tests
- abilities-api
- rest-api
- qunit/fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | 424 | | |
428 | 425 | | |
429 | 426 | | |
| |||
466 | 463 | | |
467 | 464 | | |
468 | 465 | | |
469 | | - | |
470 | | - | |
471 | | - | |
| 466 | + | |
| 467 | + | |
472 | 468 | | |
473 | 469 | | |
474 | 470 | | |
| |||
495 | 491 | | |
496 | 492 | | |
497 | 493 | | |
498 | | - | |
| 494 | + | |
499 | 495 | | |
500 | 496 | | |
501 | 497 | | |
| |||
504 | 500 | | |
505 | 501 | | |
506 | 502 | | |
507 | | - | |
508 | | - | |
| 503 | + | |
| 504 | + | |
509 | 505 | | |
510 | 506 | | |
511 | 507 | | |
| |||
Lines changed: 63 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| |||
447 | 452 | | |
448 | 453 | | |
449 | 454 | | |
450 | | - | |
451 | | - | |
452 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
453 | 472 | | |
454 | 473 | | |
455 | 474 | | |
| |||
469 | 488 | | |
470 | 489 | | |
471 | 490 | | |
472 | | - | |
| 491 | + | |
473 | 492 | | |
474 | 493 | | |
475 | 494 | | |
| |||
496 | 515 | | |
497 | 516 | | |
498 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
499 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
500 | 559 | | |
501 | 560 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
135 | 143 | | |
136 | 144 | | |
137 | 145 | | |
138 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
139 | 150 | | |
140 | 151 | | |
141 | 152 | | |
142 | | - | |
| 153 | + | |
143 | 154 | | |
144 | 155 | | |
145 | 156 | | |
146 | 157 | | |
| 158 | + | |
147 | 159 | | |
148 | 160 | | |
149 | 161 | | |
| |||
155 | 167 | | |
156 | 168 | | |
157 | 169 | | |
| 170 | + | |
158 | 171 | | |
159 | 172 | | |
160 | 173 | | |
| |||
0 commit comments