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
- How can I add an image upload field directly to a custom write panel?
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How do i best handle custom plugin page actions?
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- Export data as CSV in back end with proper HTTP headers
- 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?
- How do you create a custom edit.php / edit pages page
- Cancel post save
- 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 add quick edit and bulk edit fields to users admin section
- How to add custom content under plugin row in WordPress admin plugin list?
- How to put placeholder text in the main post input area?
- 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
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- Print WordPress username id inside JavaScript
- 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?
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- add a class when login
- Add a panel to edit post
- Where should I put “run once” plugin pages?
- Using the default wordpress uploader inside plugin
- Issue plugin commands in admin settings page
- Subscribe to author?
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- maintaing consistent layout wordpress dashboard
- Replacing Scripts in Admin Load_Scripts
- 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
- On cliking add new post redirect user to a custom page first
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Prevent third party plugin’s admin page access based on user type
- 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?
- Admin – Handle data before creating or updating a post, page or custom post
- wp_filesystem put_contents issue with owner/group
- Password field is empty when using wp_signon();
- How can I replace content in the WP Admin area before an admin page is rendered?
- 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
- How to load library scripts in admin from plugins in noConflict wrapper?
- 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
- Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- How do I link to a php file in my plugin directory?
- WordPress Admin Login Custom Logo
- How to build a fool proof AdSense revenue sharing model?
- How to create custom settings page for custom plugin
- Hide custom post type by user roles
- 400 Bad Request, in wordpress theme development, wp_ajax
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- How to import the css in the plugin admin area?
- Creating multiple wp_editer() text fields in for loop — the text/visual switch only works for first editor
- Displaying “One Time” Notification in Plugins
- How to allow only two (or more) users access to a plugin
- First and last name fields not filled when using wp_insert_user
- Admin Subpages without Menu entry
- get author of published post
- 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
- Data not insert and update through ajax and jQuery in admin page?
- Catching Form Submission in WordPress Admin Panel
- Redirect in WordPress plugin
- Update a user profile via frontend