Skip Navigation

[Resolved] Content Template error on line 141

This support ticket is created 2 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 7.47 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 17 replies, has 2 voices.

Last updated by Shane 2 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2329729

I just exported toolset views, forms and types and imported to another site. The new site is getting this error

Warning: Invalid argument supplied for foreach() in /home/customer/www/502deals.com/public_html/wp-content/plugins/wp-views/backend/Models/ContentTemplate/UsagePostType.php on line 141

Any help is appreciated and let me know if you need more info. Thank You for your time.

#2329775

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

Thank you for getting in touch.

Is this view a block view or was it created with the classic editor ?

Also how was the view migrated to the new site.

Thanks,
Shane

#2329777

Thank You Shane. The View was created using toolset views(legacy) and imported using toolset export/import.

#2330227

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

Thank you for the information. Given that the message is a warning, it would be considered as non-critical. Is there just one instance of the notice? Also does it appear when you visit a particular page or is it just in our php log only once.

Please let me know.
Thanks,
Shane

#2330309

It appears on the top of our websites main page and every single listing.

#2330349

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

Please where applicable please provide me with a link to an example page where I can see the issue.

I've enabled the private fields for your next response.
Thanks,
Shane

#2334429

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

The issue isn't caused by the view but by the content template assigned to the view.

If you remake this content template then it should remove this error for you. As I say it is just a warning and shouldn't affect your usage of the plugin.

I suspect this notice is only showing because your wordpress debugging is enabled in your wp-config.php file.

Thanks,
Shane

#2335527

Even when I delete that content template it still shows the error. Also debugging is not enabled in my wp-config.php

#2336207

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

Thank you for the patience. I took a copy of your site so that I can test this issue further here.

The issue is being caused by 4 of your content templates.
"Content Template for Listing PDF Download"
"Content template for Listings "
" Content Template for Listings w Email Gate"
"Edit Listing"

Were these 4 templates imported from another site that have different custom post types assigned ? If so then this seems to be the cause as their originally assigned post types are no longer available. Deleting these resolved the issue on my end.

Thanks,
Shane

#2339855

Those content templates are assigned to the "listings" custom post type just as they were on the original site. Deleting my hardwork is not a solution. This was created, exported and imported using toolset. This should work. Also most of those content templates aren't even attached to a post type.

#2339857

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Olivier,

These are the templates that are causing the issue.

Were these templates assigned to different post types on the website where you exported them from?

If so then you may need to re-export them and re-import them after you've removed the post type assignment. It would appear that the original post type assignments are still stored in the export data for the content templates.

Please let me know if this is possible to do.
Thanks,
Shane

#2339861

That is not possible since that is not the case. The custom post type and content templates were made using toolset and exported and imported using toolset. No changes were made to those assignments nor the custom post type before, during or after import/export. Only 1 is assigned to the "Listings" CPT and 1 is the content template for the edit form for the CPT. The others are not assigned.

"Content Template for Listing PDF Download" NOT ASSIGNED
"Content template for Listings " NOT ASSIGNED
" Content Template for Listings w Email Gate" ASSIGNED TO LISTINGS CPT
"Edit Listing" USED AS CONTENT TEMPLATE FOR EDIT OF LISTINGS CPT

#2339881

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

So you're saying these content templates were not assigned to a post type. Were the post types from the original site exported as well ?

Also how were the templates migrated? Was it done manually or was it done using a migration plugin? These templates are definitely this issue as when I removed them from my copy of your site the issue was no longer present.

Please let me know so I can see how best we can come up with any alternatives.

Thanks,
Shane

#2339905

They were migrated using toolset's Export/Import feature. Types, CRED Forms, Views, Content Templates were all migrated using Toolset's built in export/import feature.

#2339961

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Oliver,

Can you re-migrate the templates using this plugin below.
https://toolset.com/download/toolset-module-manager/

You will need to install it on the site that you're exporting from and this site as well. This allows you to export the content templates as modules.

Once you've done this please let me know. Also if i'm able to get access to the site that you're exporting the content templates from please let me know.

Thanks,
Shane