How Can I Set the Post Author of a Post I Just Created With PHP?

If you know the ID of the author you can use wp_insert_post specifying the ID and the author ID to it. $id = $post->ID; // change this to whathever $user_id = ‘4’; // change this too $the_post = array(); $the_post[‘ID’] = $id; $the_post[‘post_author’] = $user_id; wp_insert_post( $the_post ); The trick is to specify the ID … Read more

Show selected value in a drop down menu

WordPress has a great little function built in for handling selections. <option <?php selected(‘value1’, ‘value2′);?> value=”foo”>Bar</option> You can also check out these form handling functions: checked() http://codex.wordpress.org/Function_Reference/checked disabled() http://codex.wordpress.org/Function_Reference/disabled Your HTML syntax is wrong as well. Per W3C, ‘value’ is not an attribute of the select tag. The value of a select is defined in … Read more

How do I create a separate page for each author?

Create an author.php template by copying your themes archive template to start with. Then you can modify it as you wish. WordPress will use this author template for every author on your site automatically As an example visit damien.co/author/damiensaunders Note you may have to change your authors names as Damien (space) Saunders doesn’t become damien%20saunders … Read more

Remove wordpress author’s capability to moderate comments on their own posts

From quick look at code the likely permissions check for that is edit_comment capability in edit_comment() function. Your options to remove that capability roughly are: customize the role with plugin, for example Members customize role with code, probably using remove cap functionality filter thiungs around map_meta_cap or user_has_cap if you need to achieve more elaborate … Read more

How to create a page for authors? like www.myblog.com/author/

A bit like a team/contributors page. You could look at the contributors page template included in the Twenty Fourteen default theme for WordPress as an excellent example. May be a challenge to use it with another theme depending on your skill level. Another option which i have coded myself for Genesis, is a widgetized page … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)