Skip to main content

Function: removeFieldsFromPostRelatedData()

removeFieldsFromPostRelatedData(fieldsToRemove, post): PostEntity | { _embedded: { author: AuthorEntity[]; wp:featuredmedia: any; wp:term: TermEntity[][]; }; author?: AuthorEntity[]; categories?: number[]; comment_status?: "open" | "closed"; content: RenderedWithBlockStyles; date: string; date_gmt: string; excerpt: Rendered; featured_media: number; format: "link" | "status" | "image" | "aside" | "audio" | "video" | "standard" | "chat" | "gallery" | "quote"; guid: Rendered; id: number; link: string; meta: Record<string, unknown>; modified: string; modified_gmt: string; ping_status: "open" | "closed"; slug: string; status: "publish" | "future" | "draft" | "pending" | "private"; sticky: boolean; tags?: number[]; template: string; terms?: Record<string, TermEntity[]>; title: Rendered; type: string; yoast_head?: null | string; yoast_head_json?: null | YoastJSON; }

Defined in: packages/core/src/data/utils/postHandling.ts:51

Parameters

fieldsToRemove

(string | number)[]

post

PostEntity

Returns

PostEntity

{ _embedded: { author: AuthorEntity[]; wp:featuredmedia: any; wp:term: TermEntity[][]; }; author?: AuthorEntity[]; categories?: number[]; comment_status?: "open" | "closed"; content: RenderedWithBlockStyles; date: string; date_gmt: string; excerpt: Rendered; featured_media: number; format: "link" | "status" | "image" | "aside" | "audio" | "video" | "standard" | "chat" | "gallery" | "quote"; guid: Rendered; id: number; link: string; meta: Record<string, unknown>; modified: string; modified_gmt: string; ping_status: "open" | "closed"; slug: string; status: "publish" | "future" | "draft" | "pending" | "private"; sticky: boolean; tags?: number[]; template: string; terms?: Record<string, TermEntity[]>; title: Rendered; type: string; yoast_head?: null | string; yoast_head_json?: null | YoastJSON; }

_embedded

_embedded: object

_embedded.author

_embedded.author: AuthorEntity[]

_embedded.wp:featuredmedia

_embedded.wp:featuredmedia: any

_embedded.wp:term

_embedded.wp:term: TermEntity[][]

author?

optional author: AuthorEntity[]

categories?

optional categories: number[]

The terms assigned to the object in the category taxonomy.

comment_status?

optional comment_status: "open" | "closed"

Whether or not comments are open on the object.

content

content: RenderedWithBlockStyles

The content for the object.

date

date: string

The date the object was published, in the site's timezone.

date_gmt

date_gmt: string

The date the object was published, as GMT.

excerpt

excerpt: Rendered

The excerpt for the object.

featured_media: number

The ID of the featured media for the object.

format

format: "link" | "status" | "image" | "aside" | "audio" | "video" | "standard" | "chat" | "gallery" | "quote"

The format for the object.

guid

guid: Rendered

The globally unique identifier for the object.

id

id: number

Unique identifier for the object.

link: string

URL to the object.

meta

meta: Record<string, unknown>

Meta fields.

modified

modified: string

The date the object was last modified, in the site's timezone.

modified_gmt

modified_gmt: string

The date the object was last modified, as GMT.

ping_status

ping_status: "open" | "closed"

Whether or not the object can be pinged.

slug

slug: string

An alphanumeric identifier for the object unique to its type.

status

status: "publish" | "future" | "draft" | "pending" | "private"

A named status for the object.

sticky

sticky: boolean

Whether or not the object should be treated as sticky.

tags?

optional tags: number[]

The terms assigned to the object in the post_tag taxonomy.

template

template: string

The theme file to use to display the object.

terms?

optional terms: Record<string, TermEntity[]>

title

title: Rendered

The title for the object.

type

type: string

Type of Post for the object.

yoast_head?

optional yoast_head: null | string

yoast_head_json?

optional yoast_head_json: null | YoastJSON