1
vote
0answers
84 views

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 ...
0
votes
0answers
30 views

remove_filter right way

What is the right way to remove filter in condition? method 1 public function update_loop($query) { global $wp; if(!$query->is_main_query() || $query->is_admin) return; ...
0
votes
1answer
18 views

WP_NAV_MENU filter targets all menus

Im trying to replace my template's primary menu through a plugin so that I don't have to make changes to the header.php. I found this code in another question answered here in 2011 (Replacing ...
0
votes
0answers
130 views

function triggered by “manage_users_custom_column” filter not working

I am trying to add a custom column un users.php but it stays empty. I have successfully added a column to the users admin page with this code in my theme's functions.php file: function ...
0
votes
1answer
191 views

How to add custom content under plugin row in WordPress admin plugin list?

I'm looking to add a custom message under my plugin in the "Plugins" page, much like the following screenshot: What action or filter should I use? Thank you!
0
votes
3answers
184 views

How to list the Hooks and order of execution in current loading page?

I need to know the list of hooks that are called in the current page . How to identify the priority assigned to the action and filters in the action . If i want to remove the default action on ...
1
vote
2answers
33 views

Calling apply_filters on non-documented hooks

I have been trying to learn how to write plugins and I thought the best way would be to look at other plugins. I was taking a look at this one and the first lines /** * Plugin Name: Media Library ...
0
votes
1answer
83 views

How to use add_action for multiple instances of the same class

I'm writing a plugin which defines a class that is meant to be called multiple times. The class uses add_action to register it's own methods as callbacks. class MyClass { __construct($foo) { ...
0
votes
2answers
207 views

How to filter the_content() & include content from template

I am trying to filter the_content() on single page, but it looks like it is creating an infinite loop. I want to know how to fix this. I want to override the_content(). Is there any other way to ...
0
votes
1answer
285 views

How to get the post excerpt using post object?

I'm trying to show post excerpt as in navigation. I'm trying this in plugin, does it make any sense? i don't know. I used $nex_obj = get_adjacent_post(false, '', true); for next post and it returns ...
0
votes
2answers
198 views

Hook for post permalink update

I would like to know what hook should I used when the permalink/url of a post is modified. My goal is to get the old permalink and new permalink so I can used it for my plugin. Thanks. [EDIT] Just ...
0
votes
1answer
44 views

Modify a plugin function output from another plugin

I'm writing a plugin for a wordpress site using a page template using WP Types plugin. My plugin adds a shortcode tag. Shortcode tags inside 'the_content' get processed without problem. But this ...
0
votes
1answer
173 views

Is it possible to create an action hook using do_action() within add_action()?

Is it possible to create a new action hook like do_action('my-hook-name'); inside a call to add_action();? I'm aware this code doesn't work, but I was thinking something along the lines of... ...
1
vote
1answer
35 views

Is there a way to verified if an add_filter is already applied?

I have in my theme this filter: add_filter('widget_text', 'do_shortcode'); Now I'm developing a plugin where I have that same filter. I would like to know if is there a conditional that I can check ...
1
vote
1answer
145 views

Determine plugin name from within plugin_action_links filter

Is there any way to determine what plugin the plugin_action_links filter is addressing when it processes the filter? I'm trying to add some actions for each plugin on the /wp-admin/plugins.php page. ...
1
vote
1answer
69 views

Check for template part, else filter content

In a plugin which brings its own post type to the table, I wish to handle post_meta by filtering the_content - unless the user has provided their own single-{post-type}.php template. Should I run ...
3
votes
1answer
231 views

Determine which theme location a wp_get_nav_menu_items is for

Is there a way to determine which theme placement a menu is for when modifying it with the wp_get_nav_menu_items filter hook? I'd like to only add items to certain menus and I don't want to have to ...
3
votes
1answer
1k views

Using query_vars filter

I am trying to link out from the WP admin to view posts in a specific way. The url structure for this is example.com/post123/?my-preview=456 /post123/ is the regular permalink for a post. The ...
10
votes
1answer
505 views

How to create an API for my plugin?

I have been developing plugins for WordPress, most plugins I have developed use two or three classes, hence not as huge as Buddypress or WooCommerce. I am planning to develop two open source plugins ...
0
votes
1answer
221 views

Adding filter to the title without affecting the menu title

Hi I'm having problems with the the_title filter here's the code that I have: function zen_title_filter($title){ if(is_singular()){ if(!empty($_GET['asin'])){ if($title == ...
2
votes
1answer
822 views

add_filter and remove_filter added before and after wp_query

I have just started with WordPress Development, and found following block of code online (in some tutorial) function filter_where( $where = '' ) { // posts in the last 30 days $where .= " AND ...
1
vote
1answer
113 views

Two functions utilizing registration_errors filter

I wrote two plugins that utilize the registration_errors filter: add_filter( 'registration_errors', 'process_payment', 10, 3 ); add_filter( 'registration_errors', 'add_user_to_SF', 10, 3 ); When ...
1
vote
1answer
141 views

Using ob_get_content to get_search_form puts into infinite loop

I am trying to change the look of my searchform. It basically needs to have two text fields. I want this to be in form of a plugin, which anyone can activate. SO obviously I do not have any control ...
1
vote
2answers
201 views

How to change the name of the “edit my profile” link in the WordPress admin backend

I am really confused at this point. I can not figure it out how to rename Edit My Profile link in the admin backend. How can that be done?
2
votes
0answers
159 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, ...
0
votes
2answers
176 views

wordpress remove views from action links in a custom post

I have created a custom post type, but I want to remove the View link from actions, in the listing of the custom post. I have tried this snippet add_filter( 'post_row_actions',array(&$this, ...
1
vote
1answer
74 views

Creating a plugin to sanitize comment and the url field before display only

I want to create a plugin to sanitize comment and mainly the url field before display only (not before adding to database), to filter the url fields and only allow displaying this field only if it ...
0
votes
1answer
93 views

How to validate inputs with filter in register_setting callback

I now have this function that works well : function wpPartValidate_settings( $input ) { if ( check_admin_referer( 'wpPart_nonce_field', 'wpPart_nonce_verify_adm' ) ) { // Create our array for ...
2
votes
2answers
716 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
1answer
90 views

How do I set the link in the Custom Post Type admin menu?

I'm trying to create a custom button and link it to a file within the plugin. How do I get this link pointing to the path of my choice? I've tried the following but it does now work. function ...
0
votes
1answer
155 views

Is it possible to remove next-post / previous-post with out creating a custom template?

I'm creating a plugin that uses a custom post type. I do not want to make a custom template for viewing the posts and discovered I can add a filter for the_content to include my custom fields, this ...
0
votes
1answer
1k views

Where is the best place to use add_filter

Should I use the function add_filter In my plugin's init action hook or just the in the main plugin script? Since sometimes I found people is using filter all over the place and if I put in the init ...
1
vote
3answers
366 views

How can I filter blog name?

I want to filter the blog's name for Google's user agents. I have tried the_title, the_content, comment_text, single_post_title, wp_title, category_description, bloginfo hooks, but none of them ...
0
votes
2answers
38 views

How do i remove the title from a specific page

Hi need to remove the title of a specific page, this one. I could do add_filter( 'the_title', ai1ec_remove_title ); function ai1ec_remove_title( $title ) { if( 'Calendar' === $title ) { ...
0
votes
1answer
93 views

How do I replace title with my plugin?

I am developing a plugin for WordPress 3.5. My blog's default title is "Test". Here is some code of my plugin: add_filter('wp_title', 'my_replace_title'); function my_replace_title(){ return ...
0
votes
1answer
74 views

Can / should a widget plugin define its own Widget Area?

Should a plugin be able to add a widget area above the_content? (Without requiring template/theme changes.) What would be the best way to do this? Doubts: widgets typically echo output to the screen; ...
0
votes
2answers
134 views

add_filter doesn't work

I'm developing a plugin to replace a character for some user agents in titles, posts and comments but the filter doesn't work. Here is the plugin: <?php /* Plugin Name: WP-HalfSpace Description: ...
0
votes
1answer
89 views

How to get changed post title in my custom plug-in which fires when 'save_post' is called?

I created a custom WordPress plug-in that hooks onto 'save_post" using add_filter(). I need to do something with the post titles and whenever a user changes the title, my plug-in cannot get the new ...
1
vote
2answers
103 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work: ...
6
votes
1answer
2k views

How to add sub-menu to a menu generated by wp_nav_menu by using plugin

I have a menu generated by wp_nav_menu which look like <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" ...
3
votes
5answers
401 views

How do I make a theme “plugin-ready”?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
0
votes
2answers
190 views

Apply Filters Causing a 500 Internal Server Error

I have a custom post type and need to display it in a certain way. I would like other posts to display as normal. When I tried to use the following code to accomplish this, I get a 500 Internal Server ...
2
votes
1answer
934 views

How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'

I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated. I figured using the ...
0
votes
1answer
194 views

Is there an action_filter hook to add content before the post title?

I am looking to add content before the post title but not included in the markup of the title itself so adding to the_title doesn't seem to be the right hook for this. Thanks
1
vote
1answer
108 views

Valid filenames for add_action's first parameter

Some examples in WordPress' docs pass a filename to add_action rather than an action name. For example, add_action( 'load-post.php', 'callback' ); add_action( 'load-post-new.php', 'callback' ); ...
1
vote
2answers
972 views

How to get Post ID with the Add Filter Function

I'm writing a plugin and am trying to figure out how to add data to the end of a post based on some Custom Meta Information. So i've done this so far: add_filter('the_content', 'AppendMeta'); And ...
0
votes
2answers
1k views

How to append new form elements in “Add New” form of Users in Wordpress admin panel?

I'm developing a WordPress plugin and I want to append some extra form fields in add new form of Users section inside admin panel without editing core files. Can somebody help me in achieving this.
0
votes
1answer
464 views

wp_mail_from not changing from address

I wish to use the wp_mail_from hook to change the from email address submitted through a form which sends an invitation to a friend by email (I am writing my own plugin to do this). I am using the ...
0
votes
1answer
357 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. ...
1
vote
1answer
127 views

How to find the origin of a file upload from within wp_handle_upload?

I have a plugin that hooks into "wp_handle_upload" filter. Within that scope I'd like to be able to identify where the upload came from, meaning I want to treat it differently if it was uploaded from ...