Automattic / Automattic/aggregator

Post Meta not Updating

Open Beginner friendly
#62 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
21
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Post meta is not currently updating due to an incorrect post ID assignment when a target post already exists. Starting on line [866](https://github.com/Automattic/aggregator/blob/master/class-aggregate.php#L866), you'll see that the `$target_post_id` is being overridden instead of being assigned to the old post data being carried through.

This means that when updating a post (new posts work fine) the child post never receives the updated fields.

These variables should be switched.

```
if ( false !== $portal_target_post_id ) {
$target_post_id = $orig_post_data['ID'];
wp_update_post( $orig_post_data );
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read class-aggregate.php around line 866 and trace the existing-target-post path, focusing on how $target_post_id and $orig_post_data are assigned. Verify that updating an existing post passes the original post ID through and that the child receives updated fields, while new-post behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.