I am able to access the JSON using below wordpress url from my development machine but it is getting redirected to wp-login.php from our server B from where the json is being consumed. The below wordpress component is hosted server A.
https://<our DNS>/content/category/commercial//links/commonlinks/?feed=json&jsonp=?
Thanks.
]]>Thank you for the plugin. I found a bug in the template/feed-json.php. If get_the_post_thumbnail uses srcset, you’ll have two image urls and the thumbnail param will be useless. I recommend using get_the_post_thumbnail instead. no regex needed.
$single["thumbnail"] = preg_replace("/^.*['\"](https?:\/\/[^'\"]*)['\"].*/i","$1",get_the_post_thumbnail($id)); // existing version
$single["thumbnail"] = get_the_post_thumbnail_url($id); // suggested replacement
]]>
Any idea how to get more than 10 posts?
]]>Hi,
I am getting the below issue which is breaking some pages that use the feed. Do you know of a fix for this at all?
<b>Warning</b>: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in <b>/home/blogticketmaster/public_html/wp-includes/plugin.php</b> on line <b>496</b>
I have tried the solutions in the support area with no luck.
Many thanks!
Josh
]]>https://example.com/?p=17386&feed=json&callback=callback
gets double parsed as:
https://example.com/slug-of-post/feed/json/feed/json?&callback=callback
As a sidenote, https://example.com/feed/?p=17386
works correctly, outputting:
https://example.com/slug-of-post/feed/
Any workaround for this?
]]>Hello,
We have two blogs (network set up) on which we use the Feed JSON plugin. For some reason, which we can’t see, sometimes the blogs (and the server) crash randomly, and the only thing that fixes it, is deactivate and activate again the Feed JSON plugin. Please, keep in mind that we do use the JSON feeds extensively. We are running a separate site that pulls lots of JSON feeds from our blogs, and we have thousands of users every day. Normally, the numbers shouldn’t be a problem. Can you please advise? Has anyone experienced any similar issues?
FYI, the only thing we have customised on the plugin, is just add a couple more fields, that’s all. We did that in the ./wp-content/plugins/feed-json/template/feed-json.php file.
This is the gist for the custom fields:
https://gist.github.com/ialexop/7ea41508d194befd0e37
Hi,
Thanks for a great plugin.
I’ve added custom fields to the JSON template in 1.0.9. Would be great if you could incorporate in the next release.
This snippet goes in template/feed-json.php just above the line $json[] = $single;
$custom_field_keys = get_post_custom_keys();
foreach ( $custom_field_keys as $key => $value ) {
$valuet = trim($value);
if ( '_' == $valuet{0} )
continue;
$single[$value] = get_post_meta($id, $value, true);
}
The plugin defaults to 10 items but doesn’t respect the setting “Syndication feeds show the most recent” the wp_option value posts_per_rss
.
I fixed it in my plugin by changing this line:
add_action( 'do_feed_json', array( $this, 'do_feed_json'), 10, 1 );
to:
add_action( 'do_feed_json', array( $this, 'do_feed_json'), get_option( 'posts_per_rss', 10 ), 1 );
Thanks.
]]>I have upgraded both WordPress and feed-json plugins.
Each time I use feed (but not any other) URL, I see in apache error logs file:
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /var/www/website/wp-includes/plugin.php on line 470
I checked already, it’s because of do_feed_json(). Can you fix this for later version?
Please, let me know if you need more details.
Versions:
* WordPress: 3.9.1
* Feed Json: 1.0.9
Awesome plugin…easy to use. Will this work with networked WordPress sites. I see that it works on the main admin blog for a WordPress install, but would like for this to work on individual sites as well.
Example URLs:
https://example.com/user/category/events/feed/json
or
https://example.com/user/feed/json
mz
]]>Our WordPress 3.9 install was working just fine before using previous version of Feed JSON Plugin. Recently, we updated the plug-in to v1.0.9. As a result, several users reporting problems with the blog, such that no posts were being displayed. Chrome Developer Tools Console showed the following errors:
Uncaught ReferenceError: jQuery is not defined jquery.reveal.js:159
Uncaught SyntaxError: Unexpected token < blog.brackets.io/feed/json?callback=jsonp1:1
We were able to restore our site by deactivating and deleting the Feed JSON Plugin, and then installing and activating v1.0.8 instead. Everything seems to be working fine now.
Was there something else that we should have done to upgrade the Feed JSON configuration?
]]>I needed support for custom field.
I modified your code and added this to feed-json/template/feed-json.php:
//custom_fields
$custom_fields = get_post_custom();
foreach($custom_fields AS $key => $value) {
if(substr($key, 0, 1) != "_") {
foreach($value AS $_value) {
$_value = trim($_value);
if($_value) {
$single[$key]=$_value;
}
}
}
}
after section // tags
Might be interesting for others
]]>On line 28 of the template/feed-json.php file, you have incorrectly set the cache key. Using the incrementer (which uses the time() function) to set the key means that every 12 hours (or whatever threshold you’ve set), the cache key will be different, causing the options table to fill, and the cache to miss all the time. Removing the incrementer and just using the query makes it work. Here is the code to fix that version.
$cache_key = ‘fj-query-‘ . md5( http_build_query( $query_array ) );
In the future, please mention that you removed the cache function when pushing new versions. You highlighted that caching was in 1.0.7, but then published nothing in a changelog (at least, I couldn’t find it) about the issue or that caching was removed in v1.0.8.
Thanks.
]]>I have a widget that reads the JSON feed from all categories. How do I exclude it from getting a JSON feed from one particular category but at the same time, if I call feeds for that category, I would get it. As in… I have a category called “TEST” and when I call feeds for all cetegories, post feeds from “TEST” category would not appear but if I call “test/feed/json” I will get all feeds from that category?
]]>Hello,
I get this error:
XML Parsing Error: junk after document element
Location: https://devteam-post.joanm.dev.maiden.roh.org.uk/news.json
Line Number 2, Column 1:<b>Fatal error</b>: Call to undefined function has_post_thumbnail() in <b>C:\xampp\htdocs\joanm\devteam-post\wp-content\plugins\feed-json\feed-json-template.php</b> on line <b>26</b><br />
^
]]>