wp_insert_post_data filter hook identify current action

Not sure, but seems maybe $data[‘post_status’] would be set to ‘trash’ at that point. If so, then you could just do something like… if ($data[‘post_status’] == ‘trash’) { return $data; } …before the other manipulations. EDIT That code should work then – but needs to be at top of the function, like… public function updatetitle($data) … Read more

How add a group by to the query used by the media library?

I found a solution; use pre_get_posts: add_action( ‘pre_get_posts’, ‘modify_attachments’ ); function modify_attachments( $query ) { if ( is_admin() && strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘admin-ajax.php’ ) !== false ) { add_filter( ‘posts_groupby’, ‘group_attachments’ ); } return $query; } function group_attachments( $groupby ) { $groupby .= ” guid”; return $groupby; }

Is this the proper way of switching the “Edit My Profile” link with my BuddyPress “Extended Profile” link?

Here is an example of what I’ve done: <?php $link = home_url( ‘/members/’ . bp_core_get_username( bp_displayed_user_id() ) . ‘/followers/’ ); echo “<a href=””. esc_attr( $link ) .””>Followers</a>”; ?> So maybe its home_url now, than site_url. In the echo, esc_attr gives out the $link. Change the whole bp_core_get_username( bp_displayed_user_id() ) to whatever you need – wp_get_current_user() … Read more

Are there actions or filters I can use for Ajax calls?

If you check the source for admin-ajax.php you will notice that the admin_init hook fires and that the system checks $_REQUEST[‘action’] for hooks. Given that, you could hook to admin_init, check the “request” super global, construct wp_ajax_* and wp_ajax_nopriv_* values, then use has_action() to see if anything is hooked in.

Filter Media by Featured on Admin

We can add the Featured option as a fake mime-type with: add_filter( ‘media_view_settings’, function( $settings ) { $settings[‘mimeTypes’][‘wpsefeaturedimage’] = ‘Featured’; return $settings; }); It will show up like this: Then we can use the posts_where filter and check for our fake mime type: /** * Filter for featured images in the media library popup */ … Read more

How to stop wrapping comments in P tag

Comments aren’t part of the post body. Those won’t be effected by the filters that you are trying to use. The core front end comment filters are these: 146 add_filter( ‘comment_text’, ‘wptexturize’ ); 147 add_filter( ‘comment_text’, ‘convert_chars’ ); 148 add_filter( ‘comment_text’, ‘make_clickable’, 9 ); 149 add_filter( ‘comment_text’, ‘force_balance_tags’, 25 ); 150 add_filter( ‘comment_text’, ‘convert_smilies’, 20 … Read more

Remove filter callback: method in class

Note that to remove a filter callback from the woocommerce_email_content filter, you first need to have it registered via: add_filter( ‘woocommerce_email_content’, …some-custom-callback… ); but it looks like you’re trying to remove the inline styles from the message. I guess you need the text/html content type, so try instead to override the styles with (untested): add_filter( … Read more

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