<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Get all posts from WordPress REST API	</title>
	<atom:link href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/</link>
	<description>I turn code into captivating user experiences for the web</description>
	<lastBuildDate>Wed, 14 Feb 2024 18:39:40 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>
	<item>
		<title>
		By: Michael Soriano		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41493</link>

		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Thu, 05 May 2022 15:12:46 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41493</guid>

					<description><![CDATA[@laura - that&#039;s it! the NULL is what&#039;s causing the error. Try to figure out why the 1st array in $responses is NULL. Note that $responses is multi-dimensions, meaning its an array of arrays.]]></description>
			<content:encoded><![CDATA[<p>@laura &#8211; that&#8217;s it! the NULL is what&#8217;s causing the error. Try to figure out why the 1st array in $responses is NULL. Note that $responses is multi-dimensions, meaning its an array of arrays.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Laura		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41484</link>

		<dc:creator><![CDATA[Laura]]></dc:creator>
		<pubDate>Thu, 05 May 2022 13:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41484</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41440&quot;&gt;Michael Soriano&lt;/a&gt;.

REST API is super new to me, so I apologize for all the questions. Your tutorial has come the closest to actually outputting anything, so that&#039;s why I&#039;m trying to dig into it to figure out what&#039;s wrong. When I add the var_dump($responses), I get another error, from that same json URL: &quot;array(1) { [0]=&#062; NULL }
Warning: count(): Parameter must be an array or an object that implements Countable in /path/&quot;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41440">Michael Soriano</a>.</p>
<p>REST API is super new to me, so I apologize for all the questions. Your tutorial has come the closest to actually outputting anything, so that&#8217;s why I&#8217;m trying to dig into it to figure out what&#8217;s wrong. When I add the var_dump($responses), I get another error, from that same json URL: &#8220;array(1) { [0]=&gt; NULL }<br />
Warning: count(): Parameter must be an array or an object that implements Countable in /path/&#8221;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michael Soriano		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41442</link>

		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Wed, 04 May 2022 22:29:25 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41442</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41436&quot;&gt;Laura&lt;/a&gt;.

It seems that that error for count() started in 7.2 - which I think is newer than this tutorial. 
Regardless, you can debug what you&#039;re passing in count(). Try doing a var_dump() on the main array. 

Something like: var_dump($responses) - right before the for loops where the count() is.  One of the subarrays are likely to be the culprit.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41436">Laura</a>.</p>
<p>It seems that that error for count() started in 7.2 &#8211; which I think is newer than this tutorial.<br />
Regardless, you can debug what you&#8217;re passing in count(). Try doing a var_dump() on the main array. </p>
<p>Something like: var_dump($responses) &#8211; right before the for loops where the count() is.  One of the subarrays are likely to be the culprit.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michael Soriano		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41440</link>

		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Wed, 04 May 2022 22:20:29 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41440</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41435&quot;&gt;Laura&lt;/a&gt;.

You&#039;re right - don&#039;t put that line in, that was just for the tutorial.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41435">Laura</a>.</p>
<p>You&#8217;re right &#8211; don&#8217;t put that line in, that was just for the tutorial.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Laura		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41436</link>

		<dc:creator><![CDATA[Laura]]></dc:creator>
		<pubDate>Wed, 04 May 2022 21:12:01 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41436</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41435&quot;&gt;Laura&lt;/a&gt;.

Not sure how else to determine if the array is empty. The json URL is working fine for me, fwiw: https://www.pixie-cbl-staging.com/wp-json/wp/v2/retailers?malls=ham]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41435">Laura</a>.</p>
<p>Not sure how else to determine if the array is empty. The json URL is working fine for me, fwiw: <a href="https://www.pixie-cbl-staging.com/wp-json/wp/v2/retailers?malls=ham" rel="nofollow ugc">https://www.pixie-cbl-staging.com/wp-json/wp/v2/retailers?malls=ham</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Laura		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41435</link>

		<dc:creator><![CDATA[Laura]]></dc:creator>
		<pubDate>Wed, 04 May 2022 21:10:34 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41435</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41434&quot;&gt;Michael Soriano&lt;/a&gt;.

Oh...hmmm...I hadn&#039;t put that line above &quot;$final = array()&quot; thinking that it was just supposed to demonstrate what the result of $responses[$x] would be. When I put that line in, I get another error: &quot;Parse error: syntax error, unexpected &#039;,&#039;, expecting &#039;]&#039;&quot; Could it have to do with using a CPT in place of &quot;post&quot; for my curl_init url? I don&#039;t think it does though, because I have also tried using just posts there instead, and I&#039;m still getting the errors.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41434">Michael Soriano</a>.</p>
<p>Oh&#8230;hmmm&#8230;I hadn&#8217;t put that line above &#8220;$final = array()&#8221; thinking that it was just supposed to demonstrate what the result of $responses[$x] would be. When I put that line in, I get another error: &#8220;Parse error: syntax error, unexpected &#8216;,&#8217;, expecting &#8216;]'&#8221; Could it have to do with using a CPT in place of &#8220;post&#8221; for my curl_init url? I don&#8217;t think it does though, because I have also tried using just posts there instead, and I&#8217;m still getting the errors.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michael Soriano		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41434</link>

		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Wed, 04 May 2022 20:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41434</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41431&quot;&gt;Laura&lt;/a&gt;.

So judging from the warning, one of the arrays might be empty? 

this line: 

&lt;code&gt;$responses[$response[0], $response[1], $response[2]]&lt;/code&gt;

Make sure that they contain items?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41431">Laura</a>.</p>
<p>So judging from the warning, one of the arrays might be empty? </p>
<p>this line: </p>
<p><code>$responses[$response[0], $response[1], $response[2]]</code></p>
<p>Make sure that they contain items?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Laura		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-41431</link>

		<dc:creator><![CDATA[Laura]]></dc:creator>
		<pubDate>Wed, 04 May 2022 19:43:29 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-41431</guid>

					<description><![CDATA[Hi there. I *think* this is coming close to doing what I need. I&#039;m using the PHP version. But I&#039;m getting an error: &quot;Warning: count(): Parameter must be an array or an object that implements Countable in {path} on line x&quot;

That line reads:
for($x=0;$x&#060;count($responses[$i]);$x++){

Any ideas what could be going wrong here?]]></description>
			<content:encoded><![CDATA[<p>Hi there. I *think* this is coming close to doing what I need. I&#8217;m using the PHP version. But I&#8217;m getting an error: &#8220;Warning: count(): Parameter must be an array or an object that implements Countable in {path} on line x&#8221;</p>
<p>That line reads:<br />
for($x=0;$x&lt;count($responses[$i]);$x++){</p>
<p>Any ideas what could be going wrong here?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: adjedonnie		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-1695</link>

		<dc:creator><![CDATA[adjedonnie]]></dc:creator>
		<pubDate>Tue, 28 Jul 2020 16:24:36 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-1695</guid>

					<description><![CDATA[thanks homie, this was exactly what i was looking for.
i modified it for use on external sites, added an offset parameter and an error code check due to invalid page numbers.]]></description>
			<content:encoded><![CDATA[<p>thanks homie, this was exactly what i was looking for.<br />
i modified it for use on external sites, added an offset parameter and an error code check due to invalid page numbers.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Robert		</title>
		<link>https://michaelsoriano.com/get-all-posts-from-wordpress-rest-api/#comment-1694</link>

		<dc:creator><![CDATA[Robert]]></dc:creator>
		<pubDate>Thu, 14 May 2020 14:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6293#comment-1694</guid>

					<description><![CDATA[thx for sharing this :) works like a charm... but in my case i have change the &quot;final&quot; into &quot;request&quot; so it shoulb be &quot;request.push(arguments[i][0][x]);&quot; and i remove the first applied objects  with &quot;request.splice(0, numOfCalls);&quot; and it works well. thx a lot Michael]]></description>
			<content:encoded><![CDATA[<p>thx for sharing this 🙂 works like a charm&#8230; but in my case i have change the &#8220;final&#8221; into &#8220;request&#8221; so it shoulb be &#8220;request.push(arguments[i][0][x]);&#8221; and i remove the first applied objects  with &#8220;request.splice(0, numOfCalls);&#8221; and it works well. thx a lot Michael</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
