Editing content
With content write abilities exposed, an assistant can fill in and fix content: set field values on posts, terms and users, create and update posts and terms, publish or unpublish, and delete.
Values go through the same validation as the editor, and every change is recorded with a way to undo it.
Good practice for bulk changes
A change across many entries is where an assistant saves the most time, and where a mistake costs the most. A careful run:
- Counts first: "this touches 212 Books".
- Tries one entry as a dry run, and shows you the result.
- Works in batches under one task name, so the whole run can be reviewed and reversed together.
The vx-migrate-values prompt walks the assistant through exactly this.
What to know before exposing content writes
- An empty value clears a field. Only the fields the assistant sends change, but sending an empty value deletes what was there. Expose the matching read abilities too, so the assistant sees current values before writing.
- Some deletes can't be undone. Deleting a post moves it to the trash, which can be reversed. Deleting a post permanently, or deleting a term (WordPress has no trash for terms), can't be undone.
- Assistants don't check post locks. If someone has a post open in the editor while an assistant changes it, the editor doesn't warn either of them, and whoever saves last wins. Assistants can guard against changes they didn't see, but a person with the post open won't see the assistant's change until they reload.
- Assistants act with administrator rights. Content changes by an assistant aren't limited by the per-post permissions WordPress applies to other roles, because the connected account is an administrator.
- User accounts are out of scope. An assistant can set users' field values, but can't create or delete accounts, or change roles, passwords or email addresses.
Posts and their fields are separate changes
A post's own properties (title, content, excerpt, slug, status, author, date, parent, menu order, featured image, terms, and whether it takes comments) are changed separately from its VX field values. A task that needs both is two steps of one task.
Putting posts in categories
An assistant assigns a post's categories, tags and other terms when it creates or updates the post, so a post can go live already in its categories, and many posts can be filed at once. You don't need a Taxonomy field for this, and WordPress's own category box stays as it is. The terms must already exist, so an assistant creates a missing one first.
Opening comments on existing posts
WordPress decides whether a post takes comments when the post is created. Turning on comments for a post type later leaves its existing posts closed, so an assistant opens them afterwards, many at a time. If the site closes comments on posts older than a set number of days (Settings → Discussion), those posts stay closed whatever the post says, and the assistant is told so.
Images and other files are added to the media library first, then used by their id: as the featured image, or in an Image, Gallery, Files, Video or Audio field. See Images and files.
Option pages
An assistant reads and writes an option page's settings by the page's key. A key the page has no field for is refused, and so is a value that fails a field's checks: in either case nothing is written, even when the settings span several fieldsets.
Comments
An assistant creates comments, changes their text, author, date, status and type, moves them to the trash or deletes them for good, and writes their field values, such as the rating of a review. A comment it creates is held for moderation unless it's asked to approve it, and it's written the way wp-admin writes one, without the flood and duplicate checks a visitor's comment gets.
Technical details for LLMs
- Writes:
vx-framework/set-post-values(patch;idorids),vx-framework/create-post(draft by default; core props + initial values;templateassigns a page template the active theme offers for the post type,defaultfor none),vx-framework/update-post(core props only;idsallowed only forstatus,author,date,parent,menu_order,featured_image,template,comment_status,terms),vx-framework/set-post-status(id/ids),vx-framework/delete-post(trash;force: truepermanent;id/ids);vx-framework/set-term-values,vx-framework/create-term,vx-framework/update-term(name, slug, description, parent; noids),vx-framework/delete-term(permanent);vx-framework/set-user-values(values only). - Option page writes:
vx-framework/set-option-page-values(patch; unknown keys refused; every fieldset is checked before any is saved, so a refused value, or withstricta warning, writes nothing and returnsvalidation_error; a storage failure after the first fieldset can still returnpartial: true+written_keys). - Comment writes:
vx-framework/set-comment-values(patch;idorids;if_matchfromvx-framework/get-comment-values; needsedit_comment, and a Comment Type location with no viewer condition also needsmoderate_comments).vx-framework/create-comment(postrequired;content,type,parent,author_name/author_email/author_url,user,date,statusdefaulthold, initialvalues; undo trashes it),vx-framework/update-comment(patch over the same properties;statusisapprove|hold|spam, and also takes a trashed comment out of the trash;idsonly forstatusandtype),vx-framework/delete-comment(trash;force: truepermanent;id/ids; replies move up to the parent). - Comments on a post:
comment_status(open|closed) oncreate-post/update-post; refused withcomments_not_supportedon a post type withoutcommentssupport (post_commentsin the post type config). Create defaults to WordPress's default for the type. Opening one thatcomments_open()still reports closed returns a warning:comments_closed_by_age(Discussion's close-after-N-days setting, for the post typesclose_comments_for_post_typesnames,postby default) orcomments_closed_by_site(anothercomments_openfilter).vx-framework/get-post-valuesreportscomment_statuson post types that support comments. - Terms:
terms: { <taxonomy>: [term ids] }oncreate-post/update-post. Each named taxonomy's terms are replaced (wp_set_object_terms, not appended) in the order given;[]clears one; unnamed taxonomies are untouched. Errors:invalid_terms(not keyed by taxonomy, or not a list of positive ids),unknown_taxonomy(not registered for the post type),unknown_term(an id that isn't a term of that taxonomy),cannot_assign_terms(noassign_terms), and oncreate-postterms_conflictwhenvaluesalso sets the taxonomy through a Taxonomy field. Terms are applied after the values and before the status; a failure leaves a create a draft withterms_failed. On create, WordPress's default category still applies to apostwhencategoryisn't named.vx-framework/get-post-valuesreturnstermsfor every taxonomy of the post type ([]for none,{}for a type with no taxonomies); the undo restores the previous terms of the named taxonomies only. - Conditional logic on patches: conditions are read over the stored values with the sent ones on top; a sent field its conditions hide isn't written, and returns a
hidden_by_conditionswarning when its value differs from the stored one. - Errors and warnings are
{ path, code, message }:messageis translated,codeis fixed. Value codes:required,hidden_by_conditions,minlength,maxlength,min,max,min_items,max_items,min_rows,max_rows,layout_min_rows,layout_max_rows,min_files,max_files,min_count,max_count,unknown_term,invalid_email,invalid_phone,invalid_url,invalid_color,invalid_date,invalid_time,invalid_date_range,end_before_start,invalid_file,attachment_not_found,file_type_not_allowed,file_extension_blocked,file_too_large,files_too_large,invalid_row,missing_layout,unknown_layout,unknown_field,not_writable,write_failed,delete_failed; a rule added withvxframework/fieldsets/validation_rulesreports itstype; anything elseinvalid_value. Only the file codes (invalid_file,attachment_not_found,file_type_not_allowed,file_extension_blocked) block a non-strict write. Post and term property errors carry codes too (invalid_status,unknown_author,not_an_attachment,unknown_template,invalid_date,needs_future_date,unknown_parent,own_parent,parent_loop,duplicate_name,empty_name,invalid_comment_status,comments_not_supported,invalid_terms,unknown_taxonomy,unknown_term,cannot_assign_terms,terms_conflict). - Codes from Pro field types:
max_entries,missing_start,min_date,max_date,invalid_timezone,invalid_rrule(Recurring Date);invalid_location(Location);holes_not_allowed,too_many_polygons,invalid_coordinates,too_few_points,max_vertices(Area;max_verticesblocks the write);unsupported_location(a relation on a location it can't be stored on). - Controls:
dry_run,batch_id,strict: true(warnings become errors),if_match(hash over stored values and core properties; refused together withids). Writing a field value doesn't changepost_modified; use the hash to detect concurrent edits. - Undo:
restore_valuesdescriptors carry the previous values of exactly the fields (or properties) written; past 20,000 bytes the largest of them (values, or a longcontentordescription) isstoredwith the activity entry and the descriptor namesvx-framework/undo-changeinstead, and past the payload budget the undo isnone(sizes in Activity log and undo).create-post→delete-post(trash);update-post/update-term→ same ability with previous props;set-post-status/ trash → previous status;forcedelete anddelete-term→ none;create-term→delete-term(permanent). - Permissions: the only check is
manage_options; noedit_post/publish_postsper object and no post-lock check. Count first withvx-framework/count-posts/vx-framework/count-terms/vx-framework/count-users. - Different values per post: one
vx-framework/set-post-valuesstep per post insidevx-framework/apply-changes(≤ 25 steps).