Why current_user_can(‘edit_comment’) always true?

Notice how it is singular? Comment, not comments? This capability is not designed to check if user can edit any arbitrary comment out there. It can only check if user can edit one specific comment and correct way to call it is current_user_can( ‘edit_comment’, $comment_id ). Unfortunately second argument is missing from current_user_can() function signature … Read more

How can I edit comment meta value before it is saved?

You can use “save_post” action-hook Add the code below into functions.php and enchance with your comment_meta code. function update_comments_meta( $post_id ) { // Do whatever add/update_comment_meta code you need } add_action( ‘save_post’, ‘update_comments_meta’ ); UPDATE. As an example i’ve attach code below. It performs on post save/update action fired. Code gets current post comments (all) … Read more

How do I hide tinymce within the edit screen of a particular page

Have you ever tried the functions described here? It seems to be exactly what you’re looking after. Here’s a slightly variation of the function for reference: // Run only when editing a page // For new pages load-page-new.php should be used // See: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/admin.php#L217 add_action( ‘load-page.php’, ‘hide_tinyeditor_wp’ ); function hide_tinyeditor_wp() { // Not really necessary, … Read more

How can I get the default content of WordPress post?

Yes you can access the post_content property in the loop from the $post object if ( have_posts() ) : while ( have_posts() ) : the_post(); echo $post->post_content endwhile; endif; Mention that the post_content is coming straight from the database. All ‘the_content’ filters will not be applied. For more properties see the post codex

Add PHP code after title in single post pages?

You need to use the_title filter, not the_content. Also make sure you have the_title() function somewhere in your single post page. Here is the code: function theme_slug_filter_the_content( $title ) { $custom_title=”MY CODES”; $custom_title .= $title ; return $custom_title ; } add_filter( ‘the_title’, ‘theme_slug_filter_the_content’ );

`authenticate` filter never gets called

I can think of a few possibilities, though there certainly could be more. On successful login there is a redirect to the dashboard meaning that if you expect to see something output by that function, you won’t. Try this: add_filter(‘authenticate’, ‘my_authenticate’, 1000, 2); function my_authenticate($user, $username){ var_dump($user, $username); die; // We never arrive in this … Read more

Adding html banner to posts

rss_use_excerpt is the option people can use to change the blog from Full Text to Summary. With a combination of is_front_page and that setting you can determine if you’re blog page is showing the summary — in your case — when you don’t want to show the banner on the blog page. function display_banner($content) { … Read more

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