0
votes
1answer
30 views

Replace admin header logo with an image

I want to replace the default WordPress admin bar logo to my custom logo which is a PNG file. I have tried a code it's not working. function custom_logo_admin_header() { echo ' <style ...
0
votes
2answers
32 views

How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the save_post hook: add_action('save_post', 'assign_parent_terms'); function ...
0
votes
0answers
16 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...
0
votes
1answer
18 views

Using a private method as an action callback from within a class

I have created a class from within which I would like to call a private method (from within the same class) from the __construct method as an action callback. When I would like to use a public method ...
2
votes
1answer
44 views

Enforcing password complexity

We need to enforce password complexity in a wordpress site, we used this article: http://www.webtipblog.com/force-password-complexity-requirements-wordpress/ We created the following in ...
0
votes
0answers
12 views

Presetting the link of video attached to a Standard Post Format in a custom field

I am trying to create a function that presets the URL (of an attached video in a Standard Post Format) to a custom field when the post is created using a front-end form. (P.S.: All data inputted in ...
0
votes
1answer
55 views

New checkbox in custom widget isn't saving data

I'm trying to develop my own widget. Mostly cause I want to understand Wordpress functionality (yes I'm completely new. First ever try to extend wordpress) I want to add a function to display post ...
0
votes
0answers
30 views

Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can ...
0
votes
2answers
103 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
0
votes
0answers
47 views

action that only applies when certain item is in cart

I am using a function to automatically apply a coupon for certain products.The coupon only applies to a single category and is for a one-time event where those customers are only presented this ...
6
votes
2answers
129 views

Remove Actions/Filters added via Anonymous Functions

That's a freaking bad practice I must say. Spent last two hours finding a solution to remove actions and filters added via Anonymous functions. This is the code used on a Parent Theme, and I need ...
0
votes
2answers
51 views

Override the Wordpress core function wp_referer_field

I'd like to override the core Wordpress function wp_referer_field to change the value of $referer_field variable inside of it. I've found that wp_referer_field is not pluggable and that I need to ...
0
votes
1answer
46 views

Is there a way to prevent a function/method from being called outside a specific hook?

I would like to make function only callable by a specific action, in this case the register_activation_hook() function. How can I do this?
4
votes
3answers
142 views

How to restrict actions and filters “properly” by conditions

Which one is correct when adding actions/filters/etc.... Both methods work fine and I've seen people do things both ways, but I'm assuming one is correct. My gut tells me that wrapping the if ...
0
votes
1answer
127 views

Add content after get_header

I'd like to add content directly after the div#main (end of header.php) and before /div#main (beginning of footer.php). I'm using an own child-template (of twentythirteen), that contains only ...
1
vote
2answers
30 views

How would go about if I just want a temporary function?

How would go about if I just want a temporary function? (It's a converter just for converting Access to Wordpress tables). I want to execute several times so therefore I want it automated, but I don't ...
1
vote
1answer
53 views

wordpress plugin is not activating from widget

I am just creating a plugin in wordpress. In this plugin I am trying to create a widget, In that widget it will show a title, input text and text area in the widget section and when the values will be ...
0
votes
2answers
851 views

jQuery code not working when included in functions.php

I feel like I am definitely missing something simple here... but for the life of me, can't find what I'm missing. I am of the "bad habit" of including jQuery functions directly in the header.php file ...
-1
votes
2answers
280 views

How to pass hook variable to function?

I have a function that has an add_action inside it that calls the user_register hook. I would like to be able to echo the variable $user_id from the user_register hook and the $_POST array as well. ...
0
votes
1answer
242 views

Using add_filter() in Widgets

Just have a query reference the add_filter() function. Can you use this function inside a WordPress widget class. Example I have a widget with dynamic created code that I want to pass to another ...
0
votes
2answers
63 views

Do something when user creates post (that's pending)

How do i do something when a (normal) user creates a post (that is submitted for approval) I currently have: function emailinvestment( $new_status, $old_status, $post_id ) { if ( ...
-1
votes
1answer
342 views

Call to undefined add_action() in theme's functions.php

Once done validating a form with ajax, I use php within my functions.php to actually send the form. <?php $name = $_POST['fname']; $lname = $_POST['lname']; $subject_line = $_POST['subject']; ...
0
votes
1answer
1k views

How do I find the code executed when wp_head() is called?

I am working on editing the header.php file and I am a bit confused. I am editing the header.php file and I see a call in it to wp_head(); I know that it calls a "callback function" with something ...
0
votes
0answers
50 views

Highlight posts currently being edited on multiple editor site?

I have a custom page that uses the Cleverness To-Do List plugin to display multiple posts on a page. My site has multiple editors, and if a post is currently being edited on the custom page (not the ...
0
votes
1answer
107 views

How to load several hierarchical categories from functions.php

I need to insert several categories (about 400) into my site. The categories are hierarchical. I would like to load them from functions.php but now I can add one category at time, like this: ...
0
votes
1answer
92 views

Call a function with href

Is there any way to call a function inside plugin with <a href='plugin-function'> tag? I need this to show user details which will not be bound to any action hook.
2
votes
1answer
53 views

Why do filters/actions require an argument count?

I was just looking at plugin.php trying to answer the above question and I couldn't work it out. The actual code that calls filters is this: do { foreach( (array) current($wp_filter[$tag]) as ...
0
votes
1answer
622 views

How to access function from outside of a class within this class in WP plugin?

I am developing a WP plugin called e.g. DD_Awesome_Plugin and this is my code so far (simplified version without additional code logic within class functions): class DD_Awesome_PLugin { public ...
1
vote
1answer
72 views

Wordpress Theme Update Action?

I've done quite a bit of searching. I'm looking for hook/action called after a theme update. I know the initialization one - but a basic update? Cannot seem to find. If one does not exist, how can ...
1
vote
0answers
96 views

Update User Meta after Registration [closed]

After a user registers, I am creating two pages of two different custom post types, and then need to store a custom meta value in their user data to assist with redirects later. I've found that if I ...
1
vote
2answers
480 views

Convert hyphen to underscore in permalinks

I would like to use underscore in my permalinks instead of hyphen. Current permalink: www.example.com/2013/01/hello-this-is-a-test-post/ Desired permalink ...
3
votes
2answers
88 views

How to count number of functions attached to an action hook?

I have some actions like this function simple_notification() { echo '<div>This is a notification</div>'; } add_action( 'site_notices', 'simple_notification' ); ...
1
vote
3answers
942 views

Using get_terms for custom taxonomy in functions.php

I`m trying to retrieve the names of taxonomy items and include them into a theme admin panel. function retrieve_my_terms() { global $terms; $terms = get_terms('taxonomy'); foreach ...
0
votes
1answer
116 views

Replace function in a child theme

Is there a way to replace a function by another function in a child theme? In other words, in a theme there is a function named "theme_function" and this function is called by several files inside the ...
0
votes
2answers
409 views

How to use the do_action () with parameter

I am trying to trigger an action in functions.php with the do_action() function, but I appear to need an attribute. The following do_action( 'really_simple_share button="facebook_like"'); does not ...
0
votes
1answer
125 views

function to return comma separated list of meta values

I'm customizing the admin edit.php screen and I have a column that displays a meta key $gear. But it only lists the first value instead of returning a list of all the values. Here's the bit that ...
0
votes
2answers
189 views

Auto-Tweet if Type is 'Status' using OAuth

Should be simple - I'd like WP to tweet the content of a post once (when it's published the first time) if the post format is 'status'. The code below isn't returning an error on publish, nor is it ...
0
votes
1answer
623 views

Add action hook conditionally - only when home.php in use

I am trying to add action hook in functions.php only if the page is home.php but the following does not work if ( is_page_template("home.php") ) { // do stuff } To make sure that file being used ...
2
votes
1answer
155 views

How to update feed only 2-3 times a week (for Feedburner email)?

So many of you know that Feedburner is a great (free) tool for sending out newsletters. The problem is that if you add content everyday, everyday emails will be sent out. I'd like to control on ...
1
vote
1answer
34 views

How to select a page within admin?

How does one apply an action to one particular page within admin? I've added a bunch of wysiwyg editors to one page ("Home") and now I don't need the main editor. But the function below - of course - ...
0
votes
1answer
175 views

template_redirect action only firing if logged in

add_action('template_redirect', 'add_header_redirect', 0, 0); function add_header_redirect(){ if( is_page(array(8, 'testimonials', 'Testimonials')) ){ $default_testimonial = get_permalink( ...
3
votes
1answer
461 views

Check if post is being published for the first time, or is an already published post being updated

I am building an add-on to an events module that checks for availability, since there wasn't a function for that in that module. Now that I have built the logic, there are three emails I will need to ...
1
vote
1answer
282 views

Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that ...
2
votes
1answer
1k views

add_action in a function, is it possible?

I am trying to add some js to the head using add_action('wp_head', 'js_func'); which works when posted just after the function, however I do not want it posted on every page, just the page that it's ...
0
votes
1answer
191 views

Missing argument for the function

do you know why i am missing argument 2 for this function? add_action( 'admin_notices', 'notice_handler', 10, 2); function notice_handler($error_token, $error_tag) { ... } } but when i ...
0
votes
1answer
344 views

Adding tables to dashboard pages programmatically?

I think that is not possible with some actions or filters, I know that I can do it just with html and using right css styles, and of course php to achieve what I need, or to write some minde actions. ...
4
votes
3answers
4k views

Perform an action when post is updated/published

I'd like to run a custom query using some meta data whenever a post is updated or published. Is there something I can put in functions.php to fire when those events occur?
0
votes
1answer
197 views

Setting post_id for single.php based on URL without a redirect

I'm migrating a Joomla! database to Wordpress and the website has to remain exact regarding URLs. The Joomla site has its posts with .html extensions, and the importer I created maps the Joomla file ...
1
vote
0answers
152 views

Save modified Custom Field content into another Custom Field on article save [closed]

In my articles I allow editors to enter a date in a human readable dd.mm.yyyy format into a custom field. But I also need this date as unix timestamp in the DB. So I wrote a function which takes the ...
0
votes
2answers
411 views

problem loading stylesheets to wp_head dynamically

I'm trying to create a wrapper shortcut function to register and load stylesheets in the header. currently, the function loads this css file src: http://my.test/wp-content/theme/css/.css I, ...