0

I’ve created a Custom Post Type Name 'Campaigns' and now, I would like the users of my site (only registered ones) to indicate their interest in promoting the campaign by just clicking the promote on each campaign single page. On the campaign page, they would just click on "Promote" button and they would be associated with the camp (no need for tickets, payment, …). I have no clue on where to look at to implement that (taxonomies, meta, …, ?) and how this will be stored (on user entity, on event custom post type entity)? I need help!

1
  • note that there may not be a single correct answer for this, and you need to be able to mark a single answer as the official canonically correct answer, not just the most useful response
    – Tom J Nowell
    Jan 16 at 13:17

1 Answer 1

0

You can use the update_user_meta function in WordPress to store information about the user's interest in promoting a campaign

// Assuming $user_id is the current user's ID and $campaign_id is the ID of the campaign.

update_user_meta($user_id, 'promoted_campaigns', $campaign_id, true);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.