seo icon indicating copy to clipboard operation
seo copied to clipboard

SEO property not added to existing entries

Open lanzi8 opened this issue 7 years ago • 4 comments

Description

The SEO property is not saved for an entry object, unless you open the entry in control panel and save it manually. Is it possible to add the property dynamically to a bulk of existing entries?

Steps to reproduce

  1. Create some entries
  2. Install and activate SEO Plugin
  3. Try to get SEO property for existing entries: var_dump($entry->seo); // output: null

Additional info

  • Craft version: Craft Pro 3.1.4
  • SEO version: 3.5.3
  • PHP version: 7.1.12

lanzi8 avatar Jan 25 '19 13:01 lanzi8

Adding the field to the entry should be enough for SEO to generate the titles automatically (see The Field Type).

Tam avatar Jan 28 '19 10:01 Tam

@Tam it should be, but I am experiencing an Issue where I manually have to save every entry in order for the field to be set, otherwise it is null

AlexandreKilian avatar Jan 28 '19 13:01 AlexandreKilian

@lanzi8 @AlexandreKilian is this still an issue?

Tam avatar Dec 06 '19 15:12 Tam

@lanzi8 @AlexandreKilian Am I correct in assuming that you are having this issue after adding an SEO field to existing entries? My understanding is that it is normal behavior for a field to not propagate field data until its element is saved, with the exception of field types that allow you to specify a default value (e.g. Lightswitch).

To get around having to manually resave each element, you can use the ./craft resave console command. It will automatically resave all of the elements you specify and propagate the SEO fields at that time. Use help to get details and options for specific subcommands, for example ./craft help resave/entries. For a more detailed explanation of using the console there is a great nystudio107 article.

jmauzyk avatar Feb 07 '20 14:02 jmauzyk