Why insert post function do not set the modified author without administrator panel?

the_modified_author() displays the name of the user whose ID has been stored in the _edit_last post meta field. If you want to update the ID after another user has updated the post, you can use something like update_post_meta( $post_ID, ‘_edit_last’, get_current_user_id() );. Then the new user’s name will be displayed when using the_modified_author(). Replace get_current_user_id() … Read more

Inline style HTML attribute is being stripped from all elements of a post

This is because what you’re trying to do trips a security feature, post content is passed through wp_kses_post to strip out dangerous tags Administrators however, have the unfiltered_html capability, which allows them to put arbitrary dangerous HTML in content and titles. This is why you’re able to insert the tags via the editor. This still … Read more

When creating a post how do you select the format?

As post_format is a custom taxonomy and the different formats terms, you should be able to use the tax_input parameter in the new post args array to set the format. Something along these lines, $new_post_args = array(); // e.g. $format_slug = ‘gallery’; $valid_formats = get_post_format_slugs(); if ( ‘standard’ !== $format_slug && in_array( $format_slug, $valid_formats ) … Read more

post category in wp_insert_post

I did not actually test your code thoroughly, but on the first glimpse: your form input is named post_category while you’re grabbing $_POST[‘new_cat’]. Adjusting that (e.g., set both to post_category) should already do. // EDIT And why are you grabbing $_POST[‘category’] in line 5?

WordPress implode & wp_insert_post question

The second parameter to wp_set_object_terms() takes an array, integer, or string. (array/int/string) (required) The slug or id of the term (such as category or tag IDs), will replace all existing related terms in this taxonomy. To clear or remove all terms from an object, pass an empty string or NULL. Integers are interpreted as tag … Read more

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