So the theme I used was not firing add_action( 'publish_place', 'update_package_id' );
or any of it’s variations e.g. save_post
So I created a custom hook in the functions.php file of the theme which got the post id from the url (see $_REQUEST['pid']
) here’s what it looked like:
function update_package_id() {
$postinfo = $_REQUEST['pid'];
$post = get_post($postinfo);
$author = get_userdata($post->post_author);
$author_email = $author->user_email;
$package_id = get_post_meta( $post->ID, 'package_pid', true );
$user_id = $author->ID;
update_user_meta($user_id, 'package_type', $package_id);
if (function_exists( 'AC_OnUpdateUser' )) {
$user = new WP_User( $user_id );
AC_OnUpdateUser( $user->ID, $user, FALSE );
}} add_action( 'updateusermet', 'update_package_id' );
This was then called through do_action('updateusermet');
on the post submitted success page at the bottom before get_sidebar();
I hope that helps someone
Related Posts:
- Get current user id
- Create WordPress User in backend, and automatically create a new post in Custom Post Type with user uame as the Title in the post
- Update main post with same category when creating custom post to update the modified date
- How to change default position of WP meta boxes?
- Displaying Custom Post Types In “At A Glance” Meta Box
- Display a query with multiple post types and same relationship on a single page
- how to group custom post types
- echo value from ‘select’ field type into page template using cmb2?
- Customize users’ capabilities to change a custom post’s post status
- Exclude add_filter from the admin
- WordPress 3.1 – How does one add sticky post capabilities to post types
- Posts to expire (deleted) after a date
- White screen error for a custom theme
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Custom user role not working as expected
- Limit Authors to their Own Posts on front-end excluding admins
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- How to change the admin menu “Pages” to something else
- Apply post formats to a specific post type only?
- Loading all files within a directory
- Copy custom field value to post title
- wp_insert_post generates endless posts
- What’s the difference between same wp functions get_posts(); functions in different form?
- Dequeue scripts and styles only for specific custom post type
- Function to display custom post type on front page makes menu items dissapear
- How to customize a permalink (URL) structure?
- Trigger email send after custom post publish
- Can I list a custom post type within another custom post type in the admin area?
- Can’t edit custom post type
- PHP variable not regenerating when publishing multiple posts at the same time
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- 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
- Display featured image from one CPT within another CPT query
- Best way to style first post differently?
- How to rewrite url for any specific taxonomy?
- Anon function and add_meta_box
- Shortcode not working with post counter
- Changing default ‘posts’ parameters with register_post_type_args
- Allow users to create posts without logging in?
- How to assign classes to all elements?
- How can I move (or create another) publish button?
- Load scripts based on post type
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- custom post type metaboxes not saving
- Enable taxonomies by post type in an array of CPTs
- Assign category a default post type
- Add an Outside Wrapper to my Header and Make it Full Width
- Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”
- Showing custom post type categories in the menu
- How to use a variable as a function name?
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- posts within custom post type all share the same content in the front-end
- Shortcode to return single custom post based on post taxonomy
- Using Wp_Query, Json to add Highcharts series data
- Meta box not appearing in my custom post type
- Let users upload image(s) to the post from front end
- Function to erase every post from a taxonomy
- Have custom post type Visibility be private by default, and have radio button also set to “Private”
- Sorting custom post types in edit.php : Post disappear
- Page template that uses lightbox to display post images
- Function to allow single post template based on custom taxonomy?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom Form / Search with Custom Post Type Data
- php dynamic content inside shortcode
- Different number posts per page based on custom post type term id
- Custom attachment function not working in v5.4.2?
- CPT tags not showing when editing post
- How to select meta key in custom database query
- Modify Publish Metabox location on CPT
- Persist meta box choices throughout all posts of same post type
- Why is wp_list_authors not picking up Authors from CPT’s?
- Change Search display for Custom Post Type
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Function to redirect singular post if specific meta field is empty
- fusion builder missing from custom post editor
- Autofill advanced custom field with user data
- Stored meta from attachment, video length?
- ACF saving posts
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Creating multiple profiles under one user to assign to particular posts
- custom post type does not working when adding in child theme function
- Publish post and create additional posts with same content
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- How can i call a custom method on submission of a custom plugin post type?
- Function not pulling image or text from custom post type
- Rich Custom Field for Custom Post type not saving
- Can’t preview custom post – Redirected to home page
- Custom Loop for custom post type. Compare by meta_value?
- Post AND page parameter for WP function
- How to display Author Profile based on Custom field value
- How to string lines from the_content() hook in WordPress?
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- How to I add count of custom posts listed in a post as a prefix to its title
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- Where paramaters of a custom function are coming from inside the loop?
- How to use wp_set_object_terms depending on page ID?