You can merge this two json objects via array_merge
. But you must decode before to a array. You have this inside your example, below as single source function. This should get the merged json object.
A example function, usable for your mix_cat()
method.
function mergeToJSON( $obj1, $obj2 ) {
$json1 = $this->test_cat();
$json2 = $this->test_cat1();
if ( $json1 === FALSE || $json2 === FALSE ) {
return;
}
$array1 = json_decode( $json1, TRUE );
$array2 = json_decode( $json2, TRUE );
$data = array_merge( $array1, $array2 );
return json_encode( $data );
}
Related Posts:
- OOP Plugin Development. Including external object
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Undefined method class::construct() when creating a plugin
- Usage of call back function of add_meta_box()
- Cant register rest routs from class instance
- Call to “admin_notices” hook from a static method
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Issues separating my Plugin pages into different files
- Allow only 1 taxonomy per custom post type [duplicate]
- Custom plugin: Trying to show saved data on frontend
- Fatal error: Call to undefined function plugin_dir_path()
- How to make WordPress plugin check for database changes and then do something?
- How to change date language without changing the entire site language?
- How to use copy() function and paste file in /wp-content/themes directory
- Authenticating to WordPress, using my own authentication two-factor system
- wordpress custom endpoint multiple params
- Initiate only latest version of a class
- Problem with WordPress Ajax form
- Am I not understanding plugins?
- Using Font Awesome as post thumbnail
- admin-ajax.php responding with 0
- Extend a class of a plugin
- Page Reloads Before AJAX Request Finishes
- Add htaccess rules with insert_with_markers at beginning of htaccess
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Insert array data on plugin activation
- WordPress php filter admin_body_class not working
- database interactions using OOP
- Adding Default Settings to Theme My Login plugin
- Append HTML Using Shortcode
- Customizer – Prefix Class Extension
- Extending the WP_Widget_Text class
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- WordPress ajax doesn’t display object method on jQuery .change() function
- filter default query to show just selected level of child pages in wordpress
- How to make my custom widget appear within WordPress widgets? Plugin development
- How to auto fetch customer details in Woocommerce in checkout page
- Can’t upload image using media_sideload_image
- Adding widgets to my plugin page instead of WordPress dashboard
- How to insert data into database using wp cron job
- Access Child Class of Plugin Main Class Instance
- Font Awesome changing default WordPress Font
- Download full html page with CSV export plugin
- Why is my custom post type not being activated on plug-in activation?
- How can I access string value in an array?
- Problem with AJAX in wordpress plugin
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- how to save checkbox data for custom setting?
- How to Schedule Cronjobs for start of every month and year
- Built a second plugin but it overwrote the first one
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- How to override a plugins script
- Removed jQuery script from header.php , any problems?
- How can I get plugin meta data without knowing the plugin folder?
- calling admin-ajax.php from admin-ajax.php
- Get options from database using php class
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- How does add_option() function enable action hooks to fire right after actiavtion?
- Create plugin with custom page and template caused an error `Call to undefined function get_header()`
- Settings API form – submit with AJAX
- Plugin won’t output characters with diacritics properly
- WP Hook Before a post is created
- Submit remote form to wordpress REST API and save data to custom post type
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- ACF relationship on user profile page used for allowed access
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- Looping through and combining calls to Woocommerce REST API
- Should I use wp_cache in my plugin to make it faster?
- WordPress plugin blog creation
- Store user form submitted information in post type
- How to import woocommerce custom fields data into another site?
- Add a custom link to each image in WordPress gallery
- How to access this jQuery/AJAX data in a PHP file/WordPress plugin
- post_exists stops working in a scheduled event
- register dependency css and js inside a plugin class
- Access variable from another class that was passed in constructor
- When I create a new custom post type, it replaces the old post type
- How to add delete, approve, spam Links to Comments
- Add .php to end of all WordPress Pages (multisite)
- PHP get_category() function redeclared
- Getting Member Data From WhishList Member on Register
- Setting at job with shortcode not working
- Run code before WordPress loads and insert data into WP if need be
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- global $post inside plugin query messes up every new post page in wp-admin
- wp_query (or hook) posts by date (id) in array then set post_type
- Chosen Select jquery Not Working in Plugin
- How to use Amazon Elastic Transcoder from WordPress using AWS SDK for PHP?
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- Search in particular category in wordpress
- How keep woocommerce users separeted in multisite install and keep admins on network
- I’m not able to get access $wpdb in my php file in wordpress
- How do I change the Go To Categories link in the term_updated_messages
- Login user into magento using wordpress account
- Customize create table SQL statement in any WordPress plugin