How Do I Unhook This Parent Theme Function?

wp_loaded would fire too early – you can’t remove a hook before it’s been added. I’d try adding your own hook with a higher priority, at the same level as the parent’s hook. That is, not inside an action. add_filter( ‘preprocess_comment’ , ‘my_preprocess_comment_function’, 5 ); Then within your function, remove the parent function: function my_preprocess_comment_function( … Read more

Edit a function to take different actions based on user role

wp_update_post() ends up using wp_insert_post(), which has wp_insert_post_data inside it. The filter “Filters slashed post data just before it is inserted into the database.” I think that would be suitable moment to add the custom logic you described as publishorpend method doesn’t seem to have other filters available in it. You could perhaps do something … Read more

How to add a custom class attribute into code wrapper? [duplicate]

To add your custom class to the old posts at once, you can do this via “the_content” filter and using preg_replace or preg_replace_callback function to do a REGEX replacement. A working Example: add_filter( ‘the_content’, function( $content ){ // Don’t do anything if we’re not in a single post if(! is_singular()){ return $content; } $customClass=”custom-class”; return … Read more