Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post's attachment image not saved in Post->save_meta() #26

Open
niemenmaa opened this issue Jun 25, 2020 · 0 comments · May be fixed by #27
Open

Post's attachment image not saved in Post->save_meta() #26

niemenmaa opened this issue Jun 25, 2020 · 0 comments · May be fixed by #27

Comments

@niemenmaa
Copy link

In Post class, function save_attachments creates $this->attachment_ids array with keys prefixed with attachment prefix.
L821

                $this->attachment_ids[ $attachment_prefix . $attachment_id ] =
                    Api::set_prop( $attachment, 'post_id', $attachment_post_id );

In same class, function save_meta() tries to access saved attachment ids with only the attachment id as a key: L961

                    $attachment_post_id = $this->attachment_ids[ $value ] ?? '';

resulting missing $attachment_post_id and failed import. Adding prefix also to L961 seems to fix the issue:

                    $attachment_prefix = Settings::get('attachment_prefix')
                    $attachment_post_id = $this->attachment_ids[  $attachment_prefix  . $value ] ?? '';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant