One of two things is happening here:
Invalid JSON
If the value of $extra
isn’t a properly-constructed JSON string, then json_decode( $extra )
is returning null
. echo null;
won’t print anything to the screen.
Valid JSON
If $extra
is a valid JSON string, When you json_decode()
it, you’ll get an object (specifically, a stdClass
object). There’s no way to echo
a stdClass
object; when I try that, I get a PHP warning:
PHP Warning: Uncaught Error: Object of class stdClass could not be converted to string
So your echo( $data );
line is throwing a warning, which your server is most likely suppressing.
I’d recommend using var_dump( $data );
to see what’s actually happening.
Related Posts:
- Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?
- Allow HTML in excerpt
- How to loop through JSON data in wordpress WP REST API
- WP API V2 returning Invalid User ID
- How to return the_excerpt (without echo)?
- Passing JSON data from WP Query into AJAX causing NULL errors
- Export all post from database to JSON only when the database gets updated
- Limit the Excerpt field in WP-Admin in words
- Create a new user using WP REST API and declare meta object
- Limit the_excerpt with max of x characters
- Automatic Excerpt Not Working
- How Do I Add User Custom Field to REST API Response?
- API JSON Data in WordPress
- Trim first 2 words of the exceprt
- fetch_feed: retrieve entries in the appearing order, not chronologically
- Gutenberg custom block using only register_block_type() and HTML
- Extremely slow pageload for long post when using the_content?
- how to decode % in app [closed]
- Upload a json file in php [closed]
- How to change / delete product short description in Woocommerce
- How to send user data in json format to another server when user register on wordpress site in PHP
- Excerpt unwanted text “”
- Word Count Function Preventing Permalink Editing
- Custom excerpt function re-factoring
- Parsing php string in jquery [closed]
- How to Display a Single Post Excerpt
- Vagrantpress + composer
- wp_remote_get adding backslashes
- How do I Add HTML to the_excerpt() & the_content() Output?
- Creating a Multi-Level Associative Object Using AJAX
- Mass update excerpt
- How to put “Read more” link in Custom Excerpt inside p tag?
- Error when adding excerpt to the content through functions.php
- Fetch post block/field data as JSON with WordPress API
- wp_enqueue_script seperately for each shortcode
- database sent to a JSON file
- Input data from email form not going to JSON file
- HTML tags not showing in excerpt
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- Fetching instagram api not working on wordpress
- Query Pages and post excerpts dynamically
- My custom get_the_excerpt() can’t get excerpt by ID
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Using the_excerpt() on a page
- JSON REST API WordPress only showing first 10 categories
- How to show an entire post content and not also the excerpt?
- stripping tags from excerpt in WordPress is not working
- Almost Done… Post Format Code
- Automatic excerpt is not shown with the_excerpt() command
- entire JS folder not loading in a WP theme
- Retrieve Json data and create multiple pages with it
- How to clone all WordPress Rest API end points
- Remove   from the_excerpt
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- How to remove the space before the ellipsis in excerpt?
- Need help removing […] after excerpt
- Post class only applying to first excerpt; why?
- Assign Custom classes to every Excerpt
- Problem in replacing the_content with the_excerpt()
- Sending simple variable on single page to WP JSON
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Find and print first entry from WordPress post in custom excerpt?
- Issue with json decode in WordPress – value is not returning consistently
- How does one make a URL return dynamic JSON with custom Content Type?
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Cannot figure out how to add a read more link to a manual excerpt. Please help
- Trying to modify content.php
- Need help to create WordPress page that decodes a text file and publishes it in JSON format
- wp_send_json erase last value
- Complex PHP for json_encode > how to handle/output right?
- Can’t get_users info by using json_encode
- How to trim content AND retain HTML?
- AJAX Filter WHILE Loop not working WordPress
- How to apply filter
- I want to use wordpress database in android app using json encode?
- Add point on excerpt post
- Result from wp_send_json adds line feed
- Setting pages for posts
- Search in particular category in wordpress
- Creating a function that sanitizes the custom metabox excerpt
- How can I add more code to this?
- Merging two excerpt functions to work with conditions
- I can’t seem to get excerpts showing inside get_pages and don’t know why?
- WordPress format json in postmeta table
- How to post data to a word press site in case of a mobile app
- Excerpt all post content Content Same Size without word cutting off
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- I am unable to fetch json data from wp_db
- JSON Object Value Show Undefine
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- Remove post image caption from post_excerpt();
- How to enqueue structured data as file – jsonld file seems not to work
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- REST API custom endpoints for metaboxes
- generate excerpt from the part of big text dump that contains keyword
- WordPress Register Block with metadata
- Strip and print only the numbers found in current’s post excerpt (even if they are without space)
- How to pass php array to external js file in WordPress
- Woocommerce – how can i add items to cart using onclick – multiple items at once with custom prices