MODX Community

getResources Displaying Unpublished/Deleted Content

Not sure why but getResources is displaying content that has been unpublished and/or deleted.

Even though the default is to not show those resources, I also added the showUnpublished=0 to the call but the pages still display.

I’ve tried clearing the cache and re-generating system resource uri’s with no luck.

Any advice?

1 Like

What is the actual tag you are calling getResources with?

[[getResources? 
  &parents=`-153` 
  &tpl=`displayChildList.tpl`
  &tpl_n4=`displayChildList.tpl.a` 
  &resources=`37,41,38,22,44` 
  &limit=`100`
  &sortdir=`ASC` 
  &includeTVs=`1` 
  &includeContent=`0` 
  &depth=`0`
  &sortby=`menuindex` 
  &idx=`[[+idx]]` 
  &showHidden=`1` 
  &showUnpublished=`0`
]]

In this instance resource 44 was unpublished and still showing on the site. I added the showUnpublished tag to try and force it, but it still showed. I then set the resource to Deleted and it still showed.

I tried clearing the cache manually, and it was still showing. the only way I was able to get rid of it was to remove 44 from the call above.

When you hardcode specific resources in the getResources call, it will show those regardless of published/deleted status.

Even if it is set to 0? It was already showing before I added the showUnpublished tag.

Or are you referring to the fact that I have a number of hard-coded tags so the page will be displayed no matter what?

When you use the resources property, and list specific id’s, this selects those resources regardless of any other properties or settings. The showUnpublished property only applies when querying for resources via the parents property.

OK, got it! It was specifically the call to the resource ID, which is why removing that was the only way I was able to get it to not show up.

Thanks!