WordPress itself is not very object oriented – it has objects (like WP_User, for example), but most interactions with the core API take place through plain function calls. It also depends widely on global state, though it does a good job of managing this through the abstractions of actions and filters.
In my experience there is a sweet spot between sticking to vanilla WP function calls and building classes. Go too far towards OO and you’ll end up reimplementing things that are already quite convenient. This is almost certainly the road you’re heading down if you are instantiating a new class for post creation.
But if you’re really doing something else – an API interface, a complicated accounts system, payments etc – then your points of contact with WP will be minimal and you can be as SOLID as you like within the realm of the problem you’re dealing with.
Related Posts:
- Plugin Form Submission Best Practice
- PHP error with shortcode handler from a class
- Using a plugin class inside a template
- How to create a flexible abstraction for WP_Query?
- What is the correct way to build a widget using OOP
- How to make method from plugin available in theme?
- Using OOP plugin’s methods throughout the website
- How Can I Add a Filter to Class Instance Only?
- The ideal place for storing persistent PHP objects
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Using a front controller in a WordPress plugin, any suggestions?
- set_sale_price in WooCommerce [closed]
- WordPress Ajax callback function from plugin – OOP
- How do you render_callback for register_block_type to a method in another class?
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- Registering and using actions which return results in a Plugin class
- Advice on plugin structure
- Applying OO patterns and principles to plugin development
- Creating a shortcode, but getting tied up with OOP and Classes?
- Plugin Architecture Question: How to avoid using transients
- What is the proper method of using global $post?
- Dynamically creating classes for Widget API
- WordPress class, using add_action to call member function does not work
- Remove an action by extending class and replacing it
- Using OOP inside a Plugin – Is it allowed?
- A question about add_action()
- WordPress plugin development OOP style
- OOP plugin not working
- How to call a function from a shortcode function in an oop plugin
- Bad request 400 using class based files
- functions won’t fire after I converted my code from procedural code to OOP
- Performing ajax request in wordpress
- Error when activating a custom plugin on production server
- OOP development and hooks
- How to set a public variable in someone else’s plugin class
- How to Maintain url on form submit
- How is construct function working even when variable is assigned null value?
- Object Oriented plugin, add action and variables
- How do I create Widget within plugin that uses its own class?
- How To Remove The Filter That Adds JetPack Related Content To Dom [closed]
- Method not receiving attributes from shortcode call, general OOP problems
- How to include jQuery and JavaScript files correctly?
- $_POST form request with admin-post
- How can I run AJAX on a button click event?
- Namespaces in WordPress – How do I initiate the main class?
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- Managing two editable fields in gutenberg
- Naming Admin Menus and Submenus
- How can I add/append content to the_content on the home page via a plugin?
- add javascript button to order place button
- How to register activation and deactivation hook in plugin using OOP pattern
- Does add_filter work outside functions.php
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- In woocommerce who is responsible for sending the receipt email?
- How to restore WP 5.4 behaviour where a numeric string could added to each page URL and parsed as “page” in WP 5.5?
- Block: attributes not saving
- Show dialog box in TinyMCE plugin and use WordPress php functions in it
- PHP 7 – Class Method Compatibility Issue
- Change reset password URL returned by wp_lostpassword_url() via plugin
- Plugin development: How many plugin and WordPress version combinations to support?
- Hook to get image filename when it is uploaded
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- Is it safe to call do_action and apply_filters for built-in hooks?
- Clearing cached plugin data if it is using an external object cache
- Creating a Link Text like Submit Button in Admin Page
- wp_scheduled_event being removed mysteriously
- How to extend WooCommerce API to show bookable product availability rules?
- Memberpress Hooks and Activity
- WordPress allows multiple users to have same email ID; and I’ve a problem with it!
- Enumerating shortcode attributes in JavaScript
- Delist entries in the_loop
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Can we intercept user_login and user_pass from a wp_login_form?
- How do I find the page/url where a search came from when using pre_get_posts filter?
- How to output functions from plugin inside theme
- Why does comments_open() return false when publishing a scheduled post?
- Using delete_post_meta for deleting multiple selected options
- Workflow for new importer plugin – your advices?
- Including template in shortcodes
- How to automatically activate a plugin on install
- disable defaault wordpress comments from a plugin
- WordPress plugin development theme issue
- add_editor_style to the blog editor view (Gutenberg?)
- Securing custom rest API endpoints with public access from PWA
- By adding “?login – failed” code unable to access my dashboard
- jQueryUI draggable doesn’t work in WordPress plugin
- How to prevent users from deleting their accounts?
- How do I get a reference to the HTML memory buffer while the page is being constructed?
- Experts opinions needed: How (in)secure is this approach?
- add_option_{$option} action hook not being called
- Remove all capabilities in separate method fails versus included in method
- add short code not working
- how can I insert a link on login page
- Shortcode attribute “title” doesn’t appear in $atts array
- Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php
- How to get locale within WP REST Request?
- How to add extra EXIF data when images are uploaded?
- How to boost WP custom post REST API GET queries by custom taxonomies