The problem is that there may not be a current user when that cron job runs. so you need to check if there is a logged in user, save their ID if so, then set the current user to whatever ID has the correct capabilities, do your stuff, then set it back to whatever it was before. Something like this (untested code, don’t throw this anywhere important without testing it)
$old_user = get_current_user_id();
wp_set_current_user(1); //use whatever ID you want here
//do your stuff
$post_location = array_map('intval', $post_location);
if ($post_type == 'post') {
$post_arr['tax_input'] = $post_location;
}
wp_set_current_user($old_user);
Related Posts:
- get_the_term_list without links in 3.1
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Display category posts grouped by taxonomy
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- get_query_var(‘paged’) always returns empty
- Is it possible to use one slug for Multiple Taxonomies?
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- Retrieving custom taxonomy in order, but excluding specific tax IDs
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Taxonomy query for children of parents
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- how to get title to custom tags page
- Display sub-taxonomies based on SELECTED parent-taxonomy
- How to redirect custom post type archive to first term of associated taxonomy?
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Refresh Taxonomies
- Get Bottom Most Level Taxonomy Terms?
- Get custom taxonomy description with paragraph tags
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Share taxonomy between user and posts?
- Displaying custom taxonomy terms active trail
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- List Recent Post Titles from Custom Taxonomies?
- Term count by user
- Get taxonomy parent using child slug (from merged taxonomies)
- add taxonomy as one of menu items
- Creating a custom search form
- One query to get posts and their taxonomy terms
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- Conditional display for custom fields/taxonomy
- How do I keep the page I’m on within the URL when running a search on a taxonomy?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- problem in taxonomy-{taxonomy}.php pagination
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Query posts from a child taxonomy term id
- What is the most efficient way of implementing a notification system? [closed]
- get_terms() duplicate first term of a custom taxonomy
- Retrieving only custom post types with two required terms (from diferente custom taxonomies each)?
- Best structure for entering recipes in a WordPress theme?
- Get posts by Taxonomy without terms
- Is this the proper way to get a taxonomy description into a post template?
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Admin (All posts) stop responding problem
- Why get_page_template() doesn’t show taxonomy template file name?
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- custom post type, hide or disable the status line in publish meta box
- Get post terms from multiple custom taxonomies
- How to get attached image to taxonomy..?
- delete term from taxonomy and assign in new one
- Adding Child Terms Programatically – No Warning but No dice either
- Template file renders on local install, not on web
- Set post terms by term id
- custom taxonomies label in hebrew
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- filter for thumbnail not working for custom taxonomy term
- Problems using get_the_terms in a plugin
- add pagination in wordpress page template
- Display taxonomies for custom post type
- register_taxonomy_for_object_type (images) : how to use it ?
- Restrict user to terms in a custom taxonomy registered for both posts and users
- WordPress search form and search result through ACF field in custom taxonomy
- Exporting Custom Taxonomy Description without Plugin
- How to show selected check box vendors on front end home page?
- WordPress tag or archive php file customization
- Dynamic value for get_option linked to taxonomy term_id?
- Best Method to Switch Between Terms (Custom Taxonomy)
- custom taxonomy don’t return a value
- If page is a taxonomy do X, if is a term, do Y
- Getting the parent terms adds additional empty markup [closed]
- Where to put a migration script to switch post information?
- Custom taxonomy list in two columns
- get multiple values from $_GET from multiple checkboxes
- Get post terms with hierarchical relationships
- Using wp_query is it possible to orderby taxonomy?
- Way to organize content – custom taxonomies or other way?
- Using post type archive page for taxonomy archive
- Error in Custom Taxonomy UI
- Taxonomy archive link from term id