Using admin-ajax prevents regular php form submission

You can change the form action to admin-ajax.php?action=your_action and this will work, but it’s not best practice. The ajax submition should be added via javascript, not by changing the form action (also your js function should prevent the form from submiting normally, returning false – see here an example: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/), and php handling of the … Read more

How to pass a special CSS class into widget li

function widget_display_callback( $params ) { global $wp_registered_widgets; global $my_widget_num; // Global a counter array $id = $params[0][‘widget_id’]; $sidebar_id = $params[0][‘id’]; /* Set some count for each widgets */ if( !$my_widget_num ) { // If the counter array doesn’t exist, create it $my_widget_num = array(); } if( isset( $my_widget_num[ $sidebar_id ] ) ) { // See … Read more

Add an Outside Wrapper to my Header and Make it Full Width

This should do it. I can’t test it right now. I used the genesis_header_markup_open() and the genesis_header_markup_open() Genesis functions and renamed them wpse_121660_header_markup_open() and wpse_121660_header_markup_close(). Then called them instead of the Genesis functions and added your new <div> in them. /** Reposition header outside main wrap */ remove_action( ‘genesis_header’, ‘genesis_header_markup_open’, 5 ); remove_action( ‘genesis_header’, ‘genesis_do_header’ … Read more

preg_replace not removed “class”

The hook post_thumbnail_html is just working for featured images aka post thumbnails, hence the name. I’m guessing that’s what you’re missing and where the “problem” originates. But luckily there is another hook for manipulating image tags get_image_tag, there is actually one for just altering the class get_image_tag_class too. Take a look into those. Another hook … Read more

Can my hooked uninstall class function access a global var declared in main plugin file?

The problem is that you aren’t declaring $dg_options as global here: define(‘DG_OPTION_NAME’, ‘document_gallery’); $dg_options = get_option(DG_OPTION_NAME); During uninstall you aren’t in the global scope, your file is being included by uninstall_plugin(). So you need to add this at the top of the main plugin file: global $dg_options; Really, any time you want a variable to … Read more

What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?

Actually, you can use multiple actions, at least this is what at the end of the wp_delete_term function, which runs when you click Delete on a taxonomy term: do_action( ‘delete_term_taxonomy’, $tt_id ); do_action( ‘deleted_term_taxonomy’, $tt_id ); do_action( ‘delete_term’, $term, $tt_id, $taxonomy, $deleted_term ); do_action( “delete_$taxonomy”, $term, $tt_id, $deleted_term ); The last one my be the … Read more

Is there an admin hook that will let me read GET variable before it’s too late to set the header Location

You can check the $current_screen on the current_screen action, and redirect after checking some GET conditions: function wpd_current_screen( $current_screen ) { if ( ‘toplevel_page_your_menu_item_id’ == $current_screen->base ) { // check some condition and wp_redirect( admin_url() ); exit; } } add_action( ‘current_screen’, ‘wpd_current_screen’ );