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 has a guest author term in database, but guest author does not appear in editor, and corresponding guest-author post is missing #637

Closed
benlk opened this issue Dec 18, 2018 · 1 comment

Comments

@benlk
Copy link
Contributor

benlk commented Dec 18, 2018

With co-authors plus 3.3.1 and WordPress 4.9.2, and with WordPress 5.0.1 and Classic Editor, the following behavior appears.

I have a post, which wp post get 87654 --format=csv describes thusly:

Field,Value
ID,87654
post_author,29
post_date,"2017-10-17 06:30:49"
post_date_gmt,"2017-10-17 10:30:49"
post_content,"snip"
post_status,publish
comment_status,open
ping_status,closed
post_password,
post_name,the-city-is-close-to-finalizing-its-affordable-housing-policy-but-the-politics-are-getting-messy
to_ping,
pinged,
post_modified,"2017-10-31 15:27:56"
post_modified_gmt,"2017-10-31 19:27:56"
post_content_filtered,
post_parent,0
guid,http://publicsource.org/?p=87654
menu_order,0
post_type,post
post_mime_type,
comment_count,0

The post's terms are as follows

$ wp post term list 87654 category post_tag post_format prominence post-type series author
+---------+-------------------------+----------------------------+----------+
| term_id | name                    | slug                       | taxonomy |
+---------+-------------------------+----------------------------+----------+
| 939     | author/j-dale-shoemaker | cap-authorj-dale-shoemaker | author   |
| 1070    | affordable housing      | affordable-housing         | post_tag |
| 27      | ECONOMIC DEVELOPMENT    | economic-development       | category |
| 965     | IN-DEPTH                | in-depth-news              | category |
| 6       | MONEY & POLITICS    | money-and-politics         | category |
+---------+-------------------------+----------------------------+----------+

This post does not appear in wp co-authors-plus list-posts-without-terms.

The term has metadata:

$ wp term get author 939
+------------------+----------------------------------------------------------------------------------------+
| Field            | Value                                                                                  |
+------------------+----------------------------------------------------------------------------------------+
| term_id          | 939                                                                                    |
| name             | author/j-dale-shoemaker                                                                |
| slug             | cap-authorj-dale-shoemaker                                                             |
| term_group       | 0                                                                                      |
| term_taxonomy_id | 939                                                                                    |
| taxonomy         | author                                                                                 |
| description      | J. Dale Shoemaker J. Dale Shoemaker author/j-dale-shoemaker 6467 dale@publicsource.org |
| parent           | 0                                                                                      |
| count            | 45                                                                                     |
| filter           | raw                                                                                    |
+------------------+----------------------------------------------------------------------------------------+

But it's not the only "J Dale Shoemaker" term:

$ wp term list author | grep shoe
939	939	author/j-dale-shoemaker	cap-authorj-dale-shoemaker	J. Dale Shoemaker J. Dale Shoemaker author/j-dale-shoemaker 6467 dale@publicsource.org	0	45
1240	1240	author/j-dale-shoemaker	cap-author-j-dale-shoemaker	J. Dale Shoemaker J. Dale Shoemaker author/j-dale-shoemaker 6467 dale@publicsource.org	0	10
1043	1043	dshoemaker	cap-dshoemaker	J. Dale Shoemaker J. Dale Shoemaker author/j-dale-shoemaker 6467 dale@publicsource.org	0	1

Only one of those terms has a J Dale Shoemaker author post:

$ wp post list  --post_type="guest-author" | grep shoe
6467	J. Dale Shoemaker	cap-author-j-dale-shoemaker	2017-01-09 21:32:19	publish

The question

There are three "J Dale Shoemaker" post author terms, but only one of them has the necessary guest-author post to appear in the editor.

Is there an easy way to reassign the posts from author terms 939 and 1043 to author term 1240, and delete the ghost terms?

Is there an automated way to do that for all possible mismatched authors?

Would wp co-authors-plus reassign-terms [--author-mapping=<file>] [--old_term=<slug>] [--new_term=<slug>] solve my problem?

@rebeccahum
Copy link
Contributor

Hi @benlk, looking at reassign-terms, it looks like it would meet your needs. As always, I recommend doing extensive testing before running this on production data. Alternatively, I would suggest looking at the CLI wp co-authors-plus swap-coauthors and then manually deleting the ghost post author term after.

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

No branches or pull requests

2 participants