Dobry den.
Chcel by som vytvarat nove posty na WordPress ale len s pomocov PHP. Skusal som toto
<?php
ini_set(‘display_errors’, 1);
error_reporting(E_ALL);
require(“wp-includes/post.php”);
// Create post object
$post = array(
'ID' => [ '3175' ], // Are you updating an existing post?
'post_content' => [ 'Test New Posr' ], // The full text of the post.
'post_name' => [ 'Test New Posr' ], // The name (slug) for your post
'post_title' => [ 'Test New Posr' ], // The title of your post.
'post_status' => [ 'pending'], // Default 'draft'.
'post_type' => [ 'post' ], // Default 'post'.
'post_author' => [ '1' ], // The user ID number of the author. Default is the current user ID.
'ping_status' => [ 'closed' ], // Pingbacks or trackbacks allowed. Default is the option 'default_ping_status'.
'post_parent' => [ '0' ], // Sets the parent of the new post, if any. Default 0.
'post_password' => [ '' ], // Password for post, if any. Default empty string.
'post_excerpt' => [ 'Baterka' ], // For all your post excerpt needs.
'comment_status' => [ 'closed'], // Default is the option 'default_comment_status', or 'closed'.
'post_category' => [ '' ], // Default empty.
'tags_input' => [ '' ], // Default empty.
'tax_input' => [ '' ], // For custom taxonomies. Default empty.
'page_template' => [ '' ], // Requires name of template file, eg template.php. Default empty.
);
wp_insert_post( $my_post );
?>
ale hadze mi to
Notice: Use of undefined constant “wp - assumed '“wp' in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Notice: Use of undefined constant includes - assumed 'includes' in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Notice: Use of undefined constant post - assumed 'post' in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Warning: Division by zero in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Notice: Use of undefined constant php” - assumed 'php”' in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Warning: : failed to open stream: No such file or directory in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Fatal error: require(): in /nfsmnt/hosting1_1/9/5/95f172f3-1bf2-4e58-baf2-0ac59b8517e5/king4home.com/web/onanator3000.php on line 6
Vedel by niekto poradit? Dakujem