简体   繁体   中英

How to store post-user information in wordpress

I am creating a voting option for the posts on my site. I need to be able to store which users voted for which posts. In a standard website, I would just create a userVoteXpost table with columns: userId, postId, vote. In wordpress how do I store this kind of post-user info? Should I create a new piece of post meta every time a user votes for a specific post? Something like:

<?php add_post_meta($post_id, $user_id, $vote_value); ?> 

Thanks in advance

you going in right path..
when user give vote to post than insert that
user's userID ,
postID for which user giving vote &
vote status, i mean up(1) or down(0)

& whenever user change his vote for specific post then simply update vote status value using that
user's userID & postID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM