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
- error_log() output for print_r() appearing on page
- What is the correct way to build a widget using OOP
- Allow only 1 taxonomy per custom post type [duplicate]
- Do I require the use of nonce?
- Retrieve multiple values passed to a single attribute in a shortcode
- How to change date language without changing the entire site language?
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- Authenticating to WordPress, using my own authentication two-factor system
- Use composer to load custom classes [closed]
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Initiate only latest version of a class
- Create table in database when activating plugin
- Problem with WordPress Ajax form
- allow user to select pages from dropdown in my plugin
- Using Font Awesome as post thumbnail
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- How to set a custom path, for ajax image upload folder in admin?
- admin-ajax.php responding with 0
- custom shortcode will not display the wrapped content
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Will simple function names in a class structure conflict with other plugins?
- WordPress php filter admin_body_class not working
- Common abstract class for plugins
- Use object in template part
- Same log message keeps on printing to debug.log file thousand of times
- database interactions using OOP
- How can i upload images in an admin page?
- Append HTML Using Shortcode
- Customizer – Prefix Class Extension
- Create onClick Event to Re-load a Widget
- Accessing the database from a plugin outside of action hooks
- Adding subdomain to home_url for “add_menu_page”
- How to select the contents in the text view textrea in wp_editor?
- Extending the WP_Widget_Text class
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Update results, Before deleting the related category [closed]
- How to auto fetch customer details in Woocommerce in checkout page
- Can’t upload image using media_sideload_image
- I want to add custom add to cart link [closed]
- Execute long and heavy processes
- 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?
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- Function not being called on form submit, only blank admin-post.php page
- Woocommerce Convert existing order to the cart
- Redirect posts to post editor page based on query string
- Load style and script for custom post type metabox
- Permissions error when I use my plugin to delete comments in the front-end
- Issue with WordPress Plugin Activation Hook and Table Creation
- Too few arguments – wp_login action