Skip to content

Commit

Permalink
Merge pull request #4637 from kishanprmr/wordpress-acf-fields
Browse files Browse the repository at this point in the history
feat(wordpress): Add ACF field option for create/update post actions
  • Loading branch information
abuaboud committed May 8, 2024
2 parents 118ea39 + bb8c7cb commit acfc6c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pieces/community/wordpress/package.json
@@ -1,4 +1,4 @@
{
"name": "@activepieces/piece-wordpress",
"version": "0.3.13"
"version": "0.3.14"
}
Expand Up @@ -39,6 +39,12 @@ export const createWordPressPost = createAction({
}),
featured_media_file: wordpressCommon.featured_media_file,
tags: wordpressCommon.tags,
acfFields: Property.Object({
displayName: 'Custom ACF fields',
description:
'Provide field name with value.You can find out field name from ACF plugin menu.',
required: false,
}),
categories: wordpressCommon.categories,
featured_media: wordpressCommon.featured_media,
status: wordpressCommon.status,
Expand Down Expand Up @@ -93,6 +99,13 @@ export const createWordPressPost = createAction({
requestBody['featured_media'] = context.propsValue.featured_media;
}

if (
context.propsValue.acfFields &&
Object.keys(context.propsValue.acfFields).length > 0
) {
requestBody['acf'] = context.propsValue.acfFields;
}

if (context.propsValue.featured_media_file) {
const formData = new FormData();
const { filename, base64 } = context.propsValue.featured_media_file;
Expand Down
Expand Up @@ -36,6 +36,12 @@ export const updateWordPressPost = createAction({
}),
featured_media_file: wordpressCommon.featured_media_file,
tags: wordpressCommon.tags,
acfFields: Property.Object({
displayName: 'Custom ACF fields',
description:
'Provide field name with value.You can find out field name from ACF plugin menu.',
required: false,
}),
categories: wordpressCommon.categories,
featured_media: wordpressCommon.featured_media,
status: wordpressCommon.status,
Expand Down Expand Up @@ -99,6 +105,13 @@ export const updateWordPressPost = createAction({
requestBody['featured_media'] = context.propsValue.featured_media;
}

if (
context.propsValue.acfFields &&
Object.keys(context.propsValue.acfFields).length > 0
) {
requestBody['acf'] = context.propsValue.acfFields;
}

if (context.propsValue.featured_media_file) {
const formData = new FormData();
const { filename, base64 } = context.propsValue.featured_media_file;
Expand Down

0 comments on commit acfc6c4

Please sign in to comment.