Always use the existing functions, if those functions do what you need. That way, your code has the best chance of staying functional as the Core changes. If you make direct queries to the database then you have to keep track of changes to the database and alter your code accordingly.
Using Core functions also means that hooks have the best chance of working where they are intended to work. If you make direct queries to the database you bypass those hooks, unless you make a special effort to support them. Again, you will have to monitor changes and update your code accordingly.
Also, the database is complicated making some queries are extremely complicated and easy to get wrong. Let the Core handle it when it can.
I am not against making direct queries the database but it is not something that should be done lightly. If this is a first plugin, avoid it if all possible.
Related Posts:
- Modify users.php page to create page/post on button clicked
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- Completely remove WP_Admin_Bar for specific user roles
- How to check username/password without signing in the user
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- API to trigger prompt on leaving page
- Show message on wordpress admin dashboard
- Hook the Keydown Event in the TinyMCE Post Editor
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- how to use thickbox in admin?
- WordPress REST API call generates nonce twice on every call
- Add a jQuery function to admin pages
- Is it save to require plugin.php early to be able to use get_plugin_data() earlier?
- WP Cron doesn’t save or in post body
- Create a clickable name in WP_List_Table for Plugin Admin
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- URLs of plugin resources?
- Custom user profile, registration, login page with theme
- How to use WP default post list tables in a plugin?
- Problems with removing admin bar
- Check if I am in the Admin Panel (wp-admin)?
- How to load the plugin only when logged in?
- Generating User(s) with Settings API
- How to redirect to action on custom page within admin section
- WP AJAX is not working, always returns 0
- Function Get User Object By Username?
- Check if someone is editing a post (this content is currently locked)
- Add notification bubble notice in navigation using transients
- Can I individually style items in the backend widget list?
- Where should I put “run once” plugin pages?
- Issue plugin commands in admin settings page
- maintaing consistent layout wordpress dashboard
- How to filter users list on user_status field with get_users()
- Frontend language per user
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- Problems with: manage_${post_type}_posts_columns
- Global State During an Admin Post
- Render content after post title in wp-admin
- Display custom fields in frontside user profile
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- How to add WordPress Admin “Insert Link” UI (searches through existing posts for URL) and functionality into a custom plugin?
- Is it possible to restrict all admin pages except theme customisation and storefront using plugin?
- wp_filesystem put_contents issue with owner/group
- Password field is empty when using wp_signon();
- Using ReactJS in the WordPress admin for plugin development
- template_redirect or admin-ajax.php?
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Show error message after exception handled
- global $current_user not current user
- Display list of uploaded images, filtered by user under a specific user group
- Issue with contextual help overwriting existing content
- What is the proper way to get logged in user id in a plugin?
- Enqueue script globally
- How do I link to a php file in my plugin directory?
- WordPress Admin Login Custom Logo
- How to create custom settings page for custom plugin
- Hide custom post type by user roles
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- First and last name fields not filled when using wp_insert_user
- Admin Subpages without Menu entry
- Filter for admin (back end) ‘reply to’ comment
- How to get custom post_author?
- Associate multiple email addresses with the same user account, so they can log in with either
- Catching Form Submission in WordPress Admin Panel
- Redirect in WordPress plugin
- Update a user profile via frontend
- How to add custom view links to wp-admin/post.php?
- Is it possible to load the css just on my plugin admin page?
- Best practice for Designing a Plugin with this scenario
- How do I force a download in the admin area?
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- how to get the top 10 popular blogs
- How can I change my assigned user role in WordPress 3.5.1?
- Remove Permalink Meta Box not working?
- How do I duplicate a single post, with all its properties, and save it as a different post?
- check_admin_referer()
- Adding a dropdown on the user admin
- Allowing duplicating users with same user_login and user_email
- WordPress admin panel not working
- Why User_login key doesn’t work with wp_update_user()
- How to grab data after wp user search is complete
- I cant add is_admin control to plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- How to prevent users from deleting their accounts?
- Change Label of custom post type
- Stop unauthorised file access
- Redirect with message after admin_post.php
- Upgrade routine: Interaction with user confirmation
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- Issue with iframe in TinyMCE
- Forcing ALL plugin Admin menus into a separate menu
- Multiple Users Logged In Causing Incorrect Account Returned
- admin page passing $_POST variables to itself
- first_name property missing inside register_user action hook
- modify buddpress adminbar only in admin pages
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- Create Unique and Customized User ID for Website Members in WordPress
- How to change the headline title for an admin page in a plugin?
- How do I display and edit other posts within the ‘Edit Post’ area of Wp-Admin Dashboard