What is the proper way to store per user data in admin?

[ad_1]

Hello, I’m looking to find out the best way to save an array of ids per user that’s editable from admin panel.

Example use case:
– Create an admin page with a dropdown list of all users (or searchable text box, etc). And select a user.
– Once a user has been selected, a list of pages will be loaded accompanied by a checkbox.
– There can be none, some, or all of the checkboxes checked per page.
– This will need save an array of the page ids of the pages that are checked and be connected to the user.
– On the plugin side you could do (pseudo here) myarray = get_my_array(current_user_id) which would return an array of those ids saved.
– This could then be used for example in WP_Query post__in to get those pages.

My guess would be to use to simply store it in user_meta. Is this best practice? Thank you.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer