Allow public to post on blog

If you don’t want to give users access to the WordPress admin screens and you don’t want to use a premium plugin, you should create a form in a page and use wp_insert_post with the submitted data. In your case, the “post_status” parameter could be used to “moderate”: $post = array( ‘post_title’ => $_POST[‘title_field’], ‘post_content’ … Read more

WP_Query orderby not working with meta_value_num and menu_order

Found an answer to this. Somehow WordPress’ own orderby isn’t fully functional when trying to order by multiple values. I solved this by changing WP_Query to SQL Query, and including second DESC after _postmeta.meta_value+0 SELECT XXX_posts.* FROM XXX_posts INNER JOIN XXX_postmeta ON (XXX_posts.ID = XXX_postmeta.post_id) WHERE 1=1 AND XXX_posts.post_type=”sidebar_element” AND (XXX_posts.post_status=”publish”) AND (XXX_postmeta.meta_key = ‘sidebar_element_meta_alignment’ … Read more

How to modify post content?

You might check out the content_edit_pre filter. Your example would then look like this: function wpse89725_pre_edit_content( $content, $post_id ) { $content = “nothing”; return $content; } add_filter( ‘content_edit_pre’, ‘wpse89725_pre_edit_content’, 10, 2 ); You can read more about this filter in the Codex: https://codex.wordpress.org/Plugin_API/Filter_Reference/content_edit_pre Edit: You can also try the edit_post_content filter: add_filter( ‘edit_post_content’, ‘my_pre_edit_content’, 10, … Read more