Linked Questions

1
vote
1answer
585 views

What's the difference between hooks, filters and actions? [duplicate]

It seems like the terms hooks, filters and actions are used interchangeably. What's the difference between them? What do they do? How do I use them?
-1
votes
1answer
67 views

What is the difference between add_action and add_filter [duplicate]

I just want to know what is the difference between the add_action and add_filter. I just could not get it enough in the documentation of wordpress. Can anyone explain it more broader and simpler. ...
6
votes
1answer
11k views

How to add a class to the attachment images

When I'm in the Wordpress editor and I add an external image with the 'img' button, my html result wil be like this: <img src="http://example.com/image.jpg" alt="image" /> How can ...
7
votes
2answers
1k views

Clarification on filters and hooks

I am about to start my first WordPress project and I have the task of moving customized core code that override the core into separate functions/files (this way it'll be easier to maintain when we ...
4
votes
2answers
1k views

Custom theme hooks / filters - passing arguments

I'm getting confused trying to implement these custom theme hooks. Trying to wrap my head around that. I thought i understood this. but now after reading code for several hours; it's made it worst. ...
1
vote
1answer
3k views

Validate form in functions.php, send errors back to template

I have a form in a template that upon submission should be validated, and any errors should be displayed, and if no errors, insert the data into the database. I'm new to wordpress, but my idea was ...
0
votes
1answer
2k views

changing variable through filters or action hooks

it appears i have a problem with understanding how add_action,add_filter and apply_filters work. somewhat abbreviated, i have the following scenario: in a template file i have this while ( $...
0
votes
1answer
1k views

Why won't the action hook wp_head accept parameters?

I'm working on a plugin that adds scripting to the head using add_action('wp_head',..); I have to pass a variable to the function to get my desired result. To test this I'm simple "echoing" out the ...
1
vote
1answer
969 views

Redirect customer to login if not logged in when proceeding to checkout

I'm trying to redirect customers, who are not logged in, when they push the "proceed to checkout button" on my cart page but nothing happens. Here's my code: function custom_redirect_checkout(){ if (...
0
votes
1answer
466 views

Replace video url with video player

This is my plugin, this will replace the video shortcode format [video url="http://www.youtube.com/watch?v=sOnqjkJTMaA"][video] (Requirement is to show the video when a user placed a shortcode like ...
0
votes
1answer
453 views

How apply_filters work in WordPress?

I know that how do_action works in WordPress. function foobar_func( $atts ){ // Action hook before any output! do_action( 'dr_before_get_qod_text' ); echo "foo and bar"; } add_shortcode(...
0
votes
1answer
131 views

Trying to use WP_Query to display a custom post type

I'm trying to use WP_Query in function.php to display a custom post type on a certain page. I just can't seem to get it to work, can anyone see issues with my code? nothing is output at all and there ...