Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

2
votes
1answer
745 views

WP Multisite: Adding pages on blog creation by default

I’d like to have a page added by default when a new site is created with WP Multisite. So I have my function that creates two pages: function my_default_pages() { $default_pages = ...
2
votes
1answer
104 views

How to debug removal of rewrite rule flushing?

I use Custom Post Types. I try this: functions.php add_action( 'admin_init', 'flush_rewrite_rules' ); Now I’d like to remove this again. I try this: remove_action( 'admin_init', ...
2
votes
1answer
650 views

Hooks for trashing, deleting, saving, restoring custom post type

I need some hooks especially for trashing and untrashing custom post types. However the hooks are not so clear in this case. For example, to run a function on trash, I can use ...
2
votes
2answers
1k views

Save_post for custom post type?

Is there a save_post hook for custom post types? example: save_my_post_type I know there is publish_my_post_type but I'm looking for a save hook.
2
votes
1answer
384 views

What hooks/filters are there to alter selected terms on post save?

Very simple, where would I hook/filter to alter the users selection of terms when they save a post (Update or Add)? I need to hook in all instances; such as when saving a post via AJAX, saving when ...
2
votes
1answer
375 views

In what sequence are the hooks fired when a post is “published”?

I would be grateful if someone could point out a link. I understand this may have a very lengthy answer but I searched and couldn't find any resource. Alternatively, it would also be nice if someone ...
2
votes
1answer
266 views

Post-Registration, post-meta hook?

Is there a hook in WP to access meta data of a user JUST after they have registered and meta data has been added to the database? I was reading to use profile_update, but wouldn't that be invoked ...
2
votes
2answers
1k views

Get password when user registers and save it sha1 into database

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1. In the ...
2
votes
3answers
262 views

Is it possible to remove this action? (as it's added just before it's called)

In wp-signup.php there are these lines: add_action( 'wp_head', 'wpmu_signup_stylesheet' ); get_header(); I need to remove wpmu_signup_stylesheet from the wp_head action, but I seem to be ...
2
votes
2answers
2k views

Hook/action after WP_Query gets posts to query custom tables for post-related meta

I see that there are hooks for manipulating WP_Query before it gets its posts (parse_query, pre_get_posts), but I can't seem to find any hooks for after the WP_Query object is populated. I have a ...
2
votes
1answer
67 views

Check php version before theme activation

I've got theme that requires php 5.3+ version. If older - fatal error occurs with it. So what I need to do when user try to activate this theme is to check php version before going into theme code ...
2
votes
1answer
122 views

Admin Post Update Redirection to Posts Screen

Is there a hook I can use that when a post is created or updated it goes back to the list/table page of all the posts. If it is also possible to target a post type as well that would be cracking. ...
2
votes
1answer
318 views

Difference between do_action and add_action

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example ...
2
votes
2answers
125 views

Can user_register output the password?

I'm trying to output the password of a newly created user in plain text using the user_register hook as explained in this answer. However, upon doing a var_dump of $_POST, I don't see any password ...
2
votes
1answer
382 views

How do I handle multiple Submit buttons in plugin's option page?

I'm developing my first plugin for WordPress and I'm getting a grasp of the whole hook system. I'm now stuck on a (probably) small issue, that I could possibly circumvent, but I'm afraid of coming out ...
2
votes
2answers
572 views

How to modify post content before writing to database?

Hi~ I'm back again and I'm trying to add another function to the script I was working on a plugin that notify my friends of new post that mentions(@) them. Now I want to change the plain text of my ...
2
votes
2answers
130 views

How to check what kind of saving it is?

I use save_post hook, and I have to know inside this hook function, whether it is a publishing ( draft to publish ) or is it an updating, like publish to publish or draft to draft. Is there a way to ...
2
votes
1answer
53 views

comment_email hook doesn't seem to work for comment editor field

I am building a plugin that allows users to PPK encrypt their users' IP/email data. Thus, IP/email data is set to dummy values in the comments table and encrypted values are stored in corresponding ...
2
votes
2answers
902 views

Check if action hook exists before adding actions to it

I am trying to add a rel=next and rel=prev link tags to the head element of image.php template file. I have Wordpress SEO installed and I like to hook to this plugin wpseo_head action hook to achieve ...
2
votes
1answer
212 views

wp_ajax_[service] returning 0

I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp_ajax_[$service]". The problem is when I call these services I just get a "0" ...
2
votes
2answers
268 views

Load different template file when condition met?

If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy. If I'm doing some logic checking in the hook init and say my ...
2
votes
1answer
119 views

deactivated_plugin hook: get the name of the plugin

I would like that every time any plugin previously activated, a function from my plugin be called, returning (at least) the name of the plugin, or something that allows to identify it (file name?). I ...
2
votes
1answer
259 views

Change WordPress RSS link with filter?

In my theme i use add_theme_support( 'automatic-feed-links' ); to enable the rss links. But i want to create an option to use Feedburner for the main rss feed, my problem is that i don't know how i ...
2
votes
2answers
2k views

When calling wp_title(), do you have to create some kind of “title.php” file?

... or does wp_title() already handle the various contexts in your blog? This could clarify for me how I can achieve a reusable index.php file without having all the conditional statements inside it ...
2
votes
1answer
2k views

get $post in init filter or action?

It seems that $post is only available to hooks executing at certain times. I have an "init" hook that needs to pull some data from the database using the $post->ID. So far my only workaround has ...
2
votes
1answer
2k views

add_action('wp_ajax_[action name]', myfunction) problem

I'm trying to integrate ajax in wordpress using the wp codex guidelines. In the PHP I added: wp_enqueue_script ( 'my_ajax', ADMIN_URL . 'js/ajax.js','jquery','1.0.0' ); wp_localize_script( 'my_ajax', ...
2
votes
1answer
287 views

Delete option value from array using update_option()

I have a user profile field which subscribes the user to forum posts by email. This adds the user's email address to an array in wp-options. Naturally I want the user to be able to unsubscribe, in ...
2
votes
1answer
150 views

Is there a hook to process a backbone restful PUT request inside wordpress?

I play around with Backbone.js (Great !) and want to synchronize my model data with the wordpress ajax api (3.6.1) on the server-side. Adapted to this ...
2
votes
1answer
229 views

Display custom list of tags in post/page editor with hooks

I used the information posted on this blog post to display specific tags when editing a post. The editors on my site wanted the ability to display pre-specified tags instead of the most popular ones. ...
2
votes
2answers
678 views

Issue with get_theme_mod returning a blank value instead of the saved value

I have what seems to be a rather troubling issue with the get_theme_mod function in the latest version of Wordpress. Only on particular servers (of which meet all Wordpress requirements) the function ...
2
votes
1answer
143 views

Adding markup to column text in “Edit Pages” admin page

I was wondering if there is a way to hook into the column titles in the "All Posts" admin page to modify them. For instance, I would like to change "Post" to "<strong>Headline</strong>". ...
2
votes
2answers
567 views

Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its ...
2
votes
2answers
1k views

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 ...
2
votes
1answer
2k views

Overriding The Loop with filter or hook

I'm trying to replace the $wp_query object for a specific category, without having to deal with creating a new template and creating a new WP_Query object there. My aim is to change the data ...
2
votes
2answers
599 views

Display info from custom fields in all images' HTML

Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a ...
2
votes
1answer
332 views

When to call `add_rewrite_rule` for safety

I am starting to run into situations on projects where I am combining multiple plugins which all use add_rewrite_rule and flush_rewrite_rules at different points. As we all know, calling ...
2
votes
2answers
543 views

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 ...
2
votes
1answer
754 views

How to change title attribute returned by comments_popup_link()?

I can change label of comments by altering Comment(s) from parameter of following function: comments_popup_link('No Comments;', '1 Comment;', '% Comments;'); But, seems that title attribute is ...
2
votes
1answer
2k views

Best Practices for Creating and Handling Forms with Plugins?

I'm writing a plugin that creates and handles a simple form. This has been my approach sofar, but it's turned out to have some major flaws: 1) On plugin activation, create a blank page for the form ...
2
votes
1answer
292 views

Gravity Forms field entries into wp_query loop

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
2
votes
0answers
158 views

How to add custom button to new media upload interface [duplicate]

I am developing a plugin and i want to add my own button to the wordpress media upload interface (WP version 3.5). Right next to the standard 'insert into page' button, i want my button to be there, ...
2
votes
1answer
94 views

How to save the values of checkbox to the register setting?

<?php function default_menu() { <form action="options.php" method="post"> <?php settings_fields( 'sample_check' );?> <input type="checkbox" name="sample" value="nofollow"/> ...
2
votes
2answers
133 views

Placement of Code in Plugin for hooking `save_post`

I ran into a strange Problem today developing a new Plugin. I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc ...
2
votes
2answers
127 views

add_action on inherit post status

I'm trying to use the add_action() hook to run a custom function, but am struggling with the post status. I originally tried using: add_action('pending_to_publish_portfolio', 'my_function'); ...
2
votes
1answer
87 views

Hook to edit an column on comments screen?

At the moment I'm doing add_filter("manage_edit-comments_columns", function($columns) { unset($columns["author"]); $columns_one = array_slice($columns,0,1); $columns_two = ...
2
votes
1answer
190 views

publish_post plugin hook doesn't always pass $post->post_content

I've written a simple plugin that grabs the contents of a post, as the post is published, and sends them to an external site for archiving. This generally works but when dealing with posts that ...
2
votes
1answer
322 views

Post thumbnail relative link and HTML modify

I want to remove the website url from all the_post_thumbnail() so they become relative and remove/add attributes from the output. So far I got the following code added to functions.php of the theme, ...
2
votes
1answer
145 views

Problem using role_has_cap hook

I'm trying to filter a capability check in order to work around the lack of filters to customize the user edit page in the admin area. But I can't seem to add filters to a hook, and I'm sure I'm ...
2
votes
1answer
169 views

How can I customize the upload error message in Wordpress?

After following the guide for How can I prevent uploading bmp image? to remove bmp (and in my case tiff images) from being uploaded, I tested and it is working, but noticed users are now getting the ...
2
votes
2answers
356 views

Run javascript code after wp_login hook?

after using the wp_login hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress? I want to use this top implement a notification system ...