I found an answer.
Essentially I had an infinite loop that was quite puzzling at first. It made more sense as I saw that it never iterated beyond the first item in the post array.
I found the answer here:
https://tommcfarlin.com/update-post-in-save-post-action/
The issue is that wp_update_post hooks into save_post… so every time I would reach that, it would restart again. To fix this, I changed my code to read:
function officers_onto_board_page_save( $post_id ) {
remove_action( 'save_post', 'officers_onto_board_page_save' );
//DO STUFF
add_action( 'save_post', 'officers_onto_board_page_save');
}
By removing the function and then re-adding it to save_post, it operates as expected.
Related Posts:
- Inserting data into `post meta` table?
- foreach loop inside the loop creating duplicates in output
- See if the email exists or not
- Display a query with multiple post types and same relationship on a single page
- WordPress Custom Post Types with a page as a parent?
- List page for custom post type?
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Limit Authors to their Own Posts on front-end excluding admins
- How to redirect all pages of a custom post type [duplicate]
- Show ACF field from custom taxonomy and display on the single template
- Display children and grandchildren of a custom post type
- Conditional to modify query results
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Return array of categories to php function for current post
- Create a random unique 6 digit number as custom field for custom post type
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Get rewrite slug of custom post type in template
- Get Post Primary Category
- Can’t get order_by meta_value_num to work properly
- Create custom post type on successful woocommerce order [closed]
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- How to make sure content doesn’t display if selection is empty
- How to customize a permalink (URL) structure?
- How to make a field appear only if a post meta field has a defined value?
- Insert and then update post_type by wp_update_post
- using $wpdb to get custom post type with term
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- I’d like to cycle through existing posts in a post type, showing one per day ordered by title, and starting over when the last is reached
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- How to Create Columns with WordPress and CPTUI display page ?
- Different Category system needed for the Custom Post Type
- Specifying Mouseover Icon for Custom Post
- Custom post type causes php-error in php version 5.2.17
- Assign category a default post type
- Displaying custom post types as a gallery
- Update post if exist from PHP
- Pagination hitting 404 page on /page/4
- Get data from PHP to JavaScript to set position of each post on front page
- Removing full title and breadcrumb header container for a specific post type
- When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]
- Query custom post types & Taxonomies and list them in a table on a page
- Creating a “glossary” of WordPress posts of a specific post type
- Using Pagination for Custom Post Type and keeps returning 404
- Nested Custom Taxonomies | Incorrect posts when querying
- Validate Custom Post Type fields
- meta query not retrieving posts
- How do I get the index for a custom post?
- Commas not displaying in implode
- add custom tags for custom post type in wordpress
- CPT Repeatable Fields + Undefined Index
- Function to erase every post from a taxonomy
- Custom Post Type Causes Error: Warning: call_user_func_array()
- Group episodes by seasons
- Is it a connection or relationship between 2 custom post types?
- redirect after submiting post for review
- CPT loop doesn’t seem to account for post date?
- Custom front-end form for adding post – Category problem
- Get only parent post in archive post
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Alike Shortcode using in Custom Shortcode
- Sort custom post column by generated value?
- Action on Custom Post publish
- Custom post type order by post_title
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Tell wordpress to show a single page instead of an archive page
- Get meta values from parent post and save in child post
- Change Search display for Custom Post Type
- How to store additional data that is related to core data
- PHP Notice: Unidentified index
- Add active class to foundation 6 tabs while looping categories
- save_post affect creation and deletion
- Duplicate posts in my custom loop
- Include images from pages in wp search.php results in default wp search
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- get_post_meta for Custom Post Type ( CPT )
- WordPress query posts by custom post type not workng
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Meta box not saving
- Featured image in custom post is being disabled
- Can I override the permalink/slug on creation
- Why is my custom post type slider only displaying the latest slide?
- Custom post tag images not displaying with ACF
- WordPress Custom Post Type and sort by Tags
- using ACF datepicker to filter posts on a page
- WordPress multi-query not returning as expected
- How to loose the image ‘alt’ attribute in my custom post type?
- Looping taxonomy in taxonomy?
- Retrieve post data via WPDB class
- Permalink of Custom Post Type
- posting twice from an array?
- Pagination not working on homepage
- Order custom post type is beign ignored
- Getting ACF relationship field information
- Send email on creation of custom post type and use get_post_meta()
- Just the First Metabox what saves the data!