Opened 23 months ago

Last modified 11 months ago

#17920 new defect (bug)

Unnecessary code in wp.getPage

Reported by: nprasath002 Owned by:
Priority: normal Milestone: Awaiting Review
Component: XML-RPC Version: 3.2
Severity: minor Keywords: has-patch dev-feedback
Cc:

Description

Pages Does not have categories

Attachments (1)

wp.getPage.patch (906 bytes) - added by nprasath002 23 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 follow-up: ↓ 2   F J Kaiser19 months ago

  • Keywords 2nd-opinion added

But categories can be added to pages.

comment:2 in reply to: ↑ 1   DrewAPicture19 months ago

Replying to F J Kaiser:

But categories can be added to pages.

Agreed. On one of my sites, pages rely on categories to display specific posts from said categories. At the time it was in deference to creating a new custom post type.

  • Keywords close added; 2nd-opinion removed

I close it now as I think there are enough use cases for this left.

comment:4 follow-up: ↓ 5   nacin19 months ago

We could wrap this into a post_type_supports check and save the queries.

comment:5 in reply to: ↑ 4   F J Kaiser19 months ago

Replying to nacin:

We could wrap this into a post_type_supports check and save the queries.

Would this add any performance in- or decrease?

Now there is wp_getPost. I recommend using that instead of wp_getPage. That said I'm not sure how to use post_type_supports. There isn't one for categories, right?

Weird thing is that we expect only categories and not tags or custom taxonomies. I think we should copy the stuff from _prepare_post to _prepare_page and that will solve the issue with a fallback for categories

  • Keywords dev-feedback added; close removed
  • Summary changed from Unnecessary code to Unnecessary code in wp.getPage

Wonder if we can inherit most of the getPost functionality in getPage.

Note: See TracTickets for help on using tickets.