How to prevent deleting of comments when deleting a post

To prevent the comment deletion hook into before_delete_post, and filter the query for associated comments so the deletion routine cannot find and delete those. PHP 5.3 required: add_action( ‘before_delete_post’, function( $post_id ) { add_filter( ‘query’, function( $query ) use ( $post_id ) { $find = ‘WHERE comment_parent=”; FALSE !== strpos( $query, $find . $post_id ) … Read more

Removing custom meta box added in parent theme

Note: This is the merged version between my and @toscho answers. Explanation (by @toscho) Use add_meta_boxes_page as action hook. You can find the hook in wp-admin/edit-form-advanced.php and it displays as: do_action(‘add_meta_boxes_’ . $post_type, $post); Solution(s) Try the following action, which is inside register_post_type() as well. function wpse59607_remove_meta_box( $callback ) { remove_meta_box( ‘id-of-meta-box’ , ‘page’ , … Read more

Editor access to plugin settings

Unfortunately, the plugin author did not leave room for a filter. But I did request one for you here. I suggested changing: /* Add option page */ function cd_setting_page(){ add_options_page( ‘Commenter data Settings’, ‘Commenter data Settings’, ‘administrator’, ‘commenterdata-settings’, array( $this, ‘cd_renderer’ )); } to /* Add option page */ function cd_setting_page(){ $cap = apply_filters( ‘commenter_data_settings_page_capability_filter’, … Read more

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