Articles of hooks

Stuck in redirect loop after using wp_login action

I’m stuck in a WordPress redirect loop which happened after hooking into the wp_login action. The strange thing is that I’ve already removed the piece of code in question, cleared cookies and restarted computer and servers – but the problem remains. They started immediately after I added this piece of code: function check_login_redirect() { if( […]

how to change link of some wordpress pages

I’ve made templates for the pages of my wordpress site such as: singup,signin,suggestions. Default wordpress pages link is as follows: or or I want to just link to this page to be changed as follows: or or Using what code can do this?

add_filter() function misunderstanding

I’m studying the theme “one page” and there is the following code: function onepage_sections() { $sections = array(); $sections[‘service_section’] = array( ‘id’ => ‘service_section’, ‘label’ => __(‘Service Section’, ‘one-page’), ‘callback’ => ‘onepage_service_section’, ); $sections[‘blog_section’] = array( ‘id’ => ‘blog_section’, ‘label’ => __(‘Blog Section’, ‘one-page’), ‘callback’ => ‘onepage_blog_section’, ); return apply_filters(‘onepage_sections’, $sections); } From what I […] add context

I have frame on my plugin to upload doc, docx file. I am filtering the uploaded file. If uploaded other than supported file, it will display this error I am filtering it at wp_handle_upload_prefilter to check for supported file However this filter will affect all other media uploader as well. I think, if it […]

How to set a custom path, for ajax image upload folder in admin?

I am coding my first WordPress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it automatically handles the uploads, filename and media-library integration without reloading the page. (AJAX) To do this I use Javascript for […]

WordPress admin notice in plugin function

i have sample wordpress plugin class. Im hooking woocommerce woocommerce_saved_order_items and i want create a admin notice. Add action from __construct works, but when i want create a notice in hook function it doesnt appears, where is the problem? class SomeClass { private static $instance; public function __construct() { add_action(‘woocommerce_saved_order_items’,array($this,’orderStatusChange’),10,1); add_action(‘admin_notices’, array($this,’simple_notice’)); // This works […]

Easy Digital Downloads (EDD) – Purchase Receipt emails couldn't be logged

I’m trying to log the purchase receipt email sent out by the EDD plugin, in the database. But I’m unable to do so. The custom plugin that logs emails is hooked on to wp_loaded hook and filters all emails by the following filter. add_filter( ‘wp_mail’, array( $this, ‘log_email’ ) ); But the purchase receipt emails […]

How can I remove css from a child theme?

I am using the theme twentyten as a parent theme for my child theme. I have other stylesheets I want to use and so I’m trying to figure out how to wp_deregister_style for the style.css sheet that is printed out in the head section of the html. I have checked the global $wp_styles variable around […]

specify meta_key / meta_value condition for prev_post_link and next_post_link

I’ve got a custom post type (CPT) called event. Every event has got an associated meta_key called event_date. I want to make sure that events with empty event_date won’t appear in my list of all events and in the prev/next event navigation when viewing a single event. I also want to order events by the […]

How to add attribute to output with wp_video_shortcode add_filter

I’m trying to add a ‘muted’ option to the video tag output with the content of a post using the built in wp video shortcode. I found this answer How can I get the shortcode to allow query string parameters? which has led me to the add_filter but I’m really struggling how to use it? […]