How to publish mass posts via database

Asked

Viewed 51 times

0

I’m creating an anime website. I’m wearing themeforest’s Betube Heme. I wanted to post several anime at once via bank, because posting one by one is going to be a lot of work. Currently when put it looks like in the image below: Exemplo do vídeo

And when I go to post via bank it appeared in the home, but when I open it does not open... keep loading...

Video is a custom player. The flowpayer that is integrated into the post when writing a new post...

My idea is to add several anime at the same time via bank, and add the categories and the video link at the same time... I even looked in the bank but I didn’t know where it was....

my script is like this:

INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (NULL, '1', '2019-05-04 15:31:27', '2019-05-04 18:31:27', '\r\n


Após uma cidade ser aniquilada, uma jovem chamada Yuki diz ser a única sobrevivente. Takuya, um contrabandista solitário, seguem junto com Yuki em uma jornada em direção à cidade, agora conhecida como Lost, entretanto diversos obstáculos inesperados aparecem no caminho deles. Organizações secretas e conspirações escondidas aguardam Yuki e Takuya enquanto se aproximam do mistério por trás de Lost.

\r\n', 'Shoumetsu Toshi 03', '', 'publish', 'open', 'open', '', 'shoumetsu-toshi-03', '', '', '2019-05-04 15:31:45', '2019-05-04 18:31:45', '', '289', '', '0', 'post', '', '0'); INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (NULL, '1', '2019-05-04 15:28:30', '2019-05-04 18:28:30', '', 'Shoumetsu-Toshi', '', 'inherit', 'open', 'closed', '', 'shoumetsu-toshi', '', '', '2019-05-04 15:28:30', '2019-05-04 18:28:30', '', NULL, 'http://localhost/anime/wp-content/uploads/2019/05/Shoumetsu-Toshi.jpg', '0', 'attachment', 'image/jpeg', '0'); INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (NULL, '1', '2019-05-04 15:31:27', '2019-05-04 18:31:27', '\r\n


Após uma cidade ser aniquilada, uma jovem chamada Yuki diz ser a única sobrevivente. Takuya, um contrabandista solitário, seguem junto com Yuki em uma jornada em direção à cidade, agora conhecida como Lost, entretanto diversos obstáculos inesperados aparecem no caminho deles. Organizações secretas e conspirações escondidas aguardam Yuki e Takuya enquanto se aproximam do mistério por trás de Lost.

\r\n', 'Shoumetsu Toshi 03', '', 'inherit', 'closed', 'closed', '', NULL, '', '', '2019-05-04 15:31:27', '2019-05-04 18:31:27', '', '289', '', '0', 'revision', '', '0')

2 answers

1

I managed to solve...

On the table wp-post the posts are stored.

On the table wp-Terms categories are stored, but in the wp-posts table there is no reference between the table category id wp-Terms.

On the table wp_term_relationships the object_id is the id of the post, to him we have the term_taxonomy_id which is another numerical value. In the table wp_term_taxonomy we have the term_taxonomy_id table wp_term_relationships and next door we have the term_id which is the value of the category in the table wp-Terms

So basically you need to do 3 Inserts.

wp_posts

wp_postmeta

wp_term_relationships

1

It seems that you have solved with SQL, all right, but the record remains: you can use the WP-CLI to solve this via command line, or by writing a script in php, instead of doing all this maneuver:

wp post create

wp post create --post_title="Titulo do Post" --post_content="Conteudo" --post_category="categoria1,categoria2,categoria3"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.