diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-add-tags-endpoint b/projects/packages/jetpack-mu-wpcom/changelog/fix-add-tags-endpoint new file mode 100644 index 0000000000000..ed23fbdd2ebaf --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-add-tags-endpoint @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Use the correct endpoint route for adding suggested tags on new posts. diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/suggested-tags.tsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/suggested-tags.tsx index 52e7fd8cbaa1f..79f07fb54e6a5 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/suggested-tags.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/suggested-tags.tsx @@ -2,7 +2,7 @@ import { useLocale } from '@automattic/i18n-utils'; import { Button, FormTokenField } from '@wordpress/components'; import { TokenItem } from '@wordpress/components/build-types/form-token-field/types'; import { useDispatch, useSelect } from '@wordpress/data'; -import { useEffect } from '@wordpress/element'; +import { useEffect, useState } from '@wordpress/element'; import { __, _n } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import * as React from 'react'; @@ -77,6 +77,7 @@ function SuggestedTags( props: SuggestedTagsProps ) { props.setShouldShowSuggestedTags( false ); }; const { saveTags } = useAddTagsToPost( postId, selectedTags, onAddTagsButtonClick ); + const [ isSavingTags, setIsSavingTags ] = useState( false ); useEffect( () => { if ( origSuggestedTags?.length === 0 ) { @@ -119,8 +120,13 @@ function SuggestedTags( props: SuggestedTagsProps ) {

{ __( 'Adding tags can help drive more traffic to your post.', 'jetpack-mu-wpcom' ) }

diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/use-add-tags-to-post.ts b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/use-add-tags-to-post.ts index afa6e8fe4f435..fd6f65e6d625a 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/use-add-tags-to-post.ts +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/use-add-tags-to-post.ts @@ -15,7 +15,7 @@ const useAddTagsToPost = ( postId: number, tags: string[], onSaveTags: OnSaveTag try { const result: HasAddedTagsResult = await apiFetch( { method: 'POST', - path: `/wpcom/v2/read/posts/${ postId }/tags/add`, + path: `/wpcom/v2/read/sites/${ window._currentSiteId }/posts/${ postId }/tags/add`, data: { tags }, } ); addedTags = result.added_tags ?? 0;