Well, thank you, but I don’t like off-site plugins: they’re heavy and have too many functions which I don’t need. I’m looking for a way to create my own form for posting. Here is my solution:
<?php /* Template Name: TestPost*/ ?>
<?php get_header(); ?>
<meta charset="utf-8" />
<form action="posting_page" method="post">
<label for="title">Заголовок: </label><input size="80" type="text" name="title" /><br />
<?php
$settings = array(
'textarea_name' => 'description',
'textarea_rows' => 5,
'quicktags' => false,
'media_buttons' => false,
'dfw' => true,
'tinymce' => array(
'toolbar1'=> 'bold,italic'
)
);
wp_editor($contentFromPage, 'editpost', $settings);
?>
<br /><input type="submit" name="submit" value="Send" />
<?php wp_nonce_field('some_action', 'sid'); ?>
</form>
<?php get_footer(); ?>
posting_page:
<?php get_header(); ?>
<meta charset="utf-8" />
<?php
if (isset($_POST['submit'])){
check_admin_referer('some_action', 'sid');
/*
*
* Here is posting code
*
*/
echo "Your article has been posted";
}
?>
<?php get_footer(); ?>
Is this solution acceptable or there’re possible security risks or it should not be applied by other reasons?