Articles of hooks

Using admin-ajax prevents regular php form submission

I have a page with a table of posts and groups of checkbox filters in the sidebar. Looks something like this: |___________| |_______________________| | [ ] Red | | 1. Big Red Box | | [ ] Blue | | 2. Big Blue Box | | [ ] Green | | 3. Big Green […]

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

I did reposition the <header> outside the ‘wrap class’ class by adding this function in my function.php /** Reposition header outside main wrap */ remove_action( ‘genesis_header’, ‘genesis_header_markup_open’, 5 ); remove_action( ‘genesis_header’, ‘genesis_do_header’ ); remove_action( ‘genesis_header’, ‘genesis_header_markup_close’, 15 ) ; add_action( ‘genesis_before’, ‘genesis_header_markup_open’, 5 ); add_action( ‘genesis_before’, ‘genesis_do_header’ ); add_action( ‘genesis_before’, ‘genesis_header_markup_close’, 15 ); /** Reposition […]

Flipping Book PHP Code? Any experience?

Hi there guys quick question, using FlippingBook and calling a gallery within a page or post is with something like this: [book id=’1′ /] but I want to call the gallery directly from my code, so is there any php code to achieve this? Thanks guys! Arturo

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

I need to delete some postmeta when deleting taxonomy terms from the backend. Before deleting the term, I need to retrieve the postmeta’s meka_key and the term id that is going to be deleted. Use the term id to perform some tasks and then delete the postmeta and term. I already tried using the action […]

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

I need to redirect the page based on the query vars in my plugin admin menu. I don’t know where I can hook in to read the query vars or the GET vars order to decide if the page needs to be redirected.

wp_trash_post action hook with custom post type

When a ‘contact’ cpt post is trashed, I need a metakey from another cpt ‘act’ to be deleted, I have been searching all over which hook I should use but unfortunately the codex action reference page is not very helpful. Below is the code I have. Ideally, I would also like an Admin Notice to […]

How To Make Sure That My Action Hook Executes Last

How can I make sure that my_function action hook on ‘wp_head’ is executing last? One hack, that I’m using, is to give 999999 (a big number) as the third argument. But maybe some other hook on ‘wp_head’ is giving even bigger number than this one. function my_function() { ?> <style> .custom-class{ background: blue; } </style> […]

Use an array of page template slugs and $hook

I’m using the function below to load some javascript that removes the checkbox in the User Profile that is used to toggle the Visual Editor: //Remove Visual Editor option in User Profile function remove_visual_editor_admin_script( $hook ){ if (‘user-edit.php’ != $hook) { return; } wp_enqueue_script( ‘remove_visual_script’, get_stylesheet_directory_uri().’/js/remove-visual-editor.js’, array(‘jquery’) ); } add_action(‘admin_enqueue_scripts’,’remove_visual_editor_admin_script’); It loads a simple jQuery […]

Is it safe to register a taxonomy without using any hooks?

I’m creating a WordPress site in which I wanted to use a custom taxonomy in my theme options, which I had registered using the ‘init’ hook. But the problem was that the ‘init’ hooks gets fired after the theme options (I’m using the Redux Framework plugin for the theme options). So when I used the […]

preg_replace not removed “class”

Use this code to remove the label “class” of the images, but does not work. The label does not disappear in the new post. function the_post_thumbnail_remove_class($output) { $output = preg_replace(‘/class=”.*?”/’, ”, $output); return $output; } add_filter(‘post_thumbnail_html’, ‘the_post_thumbnail_remove_class’); It only works on the main page with highlighted images(thumbnail).