Am I using an action hook correctly?

… (although I found it strange that I didn’t need to write activation or deactivation code…). You don’t need activation of deactivation code unless there is something you need to do on activation or deactivation. I tested my plugin by using a simple echo ‘fd is running’; which strangely shows up at the top of … Read more

how to repeat taxonomy in different places on wordpress

register_taxonomy( ‘taxonomy’, array( ‘post’, ‘coupons’ ), $args ); https://generatewp.com/taxonomy/ can help you. // new code taxonomias function clrp_taxonomy_post(){ global $wpdb, $app_abbr; //need $wpdb!! if(get_option($app_abbr.’_coupon_store_tax_permalink’)) $store_tax_base_url = get_option($app_abbr.’_coupon_store_tax_permalink’); else $store_tax_base_url=”store”; register_taxonomy( APP_TAX_STORE, // taxonomy stores array( APP_POST_TYPE_POST, APP_POST_TYPE ), // type POST + APP_POST_TYPE array( ‘hierarchical’ => true, ‘labels’ => array( ‘name’ => __( ‘Stores’, ‘appthemes’), … Read more

custom COOKIE on custom page

If all you are doing is setting a cookie on a page then why the complexity? Check this out for a simple answer http://www.w3schools.com/php/func_http_setcookie.asp My only thought is that you are then trying to redirect them back to WordPress and if so you may wish to check this Setting custom cookies in WordPress I’d say … Read more

Run only on plug-in activation instead of wp_head

That depends on whether your plugin is written in a procedural or object oriented style. register_activation_hook is what you want. https://codex.wordpress.org/Function_Reference/register_activation_hook How exactly you incorporate it depends on your plugin coding style. Examples listed in the Codex show multiple approaches. Procedural example: If you have a function called myplugin_activate() in the main plugin file at … Read more

Is it possible to completely replace a post with an action/filter?

You can try with using pre_get_posts add_action(‘pre_get_posts’,’alter_query’); function alter_query($query) { //gets the global query var object global $wp_query; //gets the front page id set in options $front_page_id = get_option(‘page_on_front’); if ( ‘page’ != get_option(‘show_on_front’) || $front_page_id != $wp_query->query_vars[‘page_id’] ) return; if ( !$query->is_main_query() ) return; $query-> set(‘post_type’ ,’page’); $query-> set(‘post__in’ ,array( $front_page_id , [YOUR SECOND … Read more