Tagged Questions
6
votes
1answer
165 views
How to create an API for my plugin?
I have been developing plugins for WordPress. Most plugins I have developed with two three classes and not so huge like Buddypress, WooCommerce or etc.
I am planning to make two open source plugins ...
0
votes
1answer
38 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 == ...
1
vote
1answer
30 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
34 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
36 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 ...
0
votes
0answers
24 views
attachment_fields_to_edit stopped working in plugin following 3.5 update
Following an upgrade to WP3.5 Elvin, a plugin that duplicates images (by duplicating metadata, not by actually copying the image) stopped working.
The plugin, BDN Duplicate Images, is just one file ...
1
vote
2answers
35 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?
0
votes
0answers
54 views
How to add custom button to new media upload interface
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
0answers
6 views
Registration_errors filter logic [duplicate]
I have a function that hooks into the registration_errors filter and adds a registered user to an external db. The problem is that even when the wordpress registration returns an error, the user is ...
0
votes
2answers
42 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
31 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
50 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 ...
1
vote
2answers
110 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
52 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
61 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
149 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
100 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
26 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
58 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
60 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
68 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
42 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
60 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:
...
1
vote
1answer
395 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" ...
2
votes
5answers
233 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
114 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 ...
1
vote
1answer
436 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
114 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
82 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
231 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
614 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
279 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
197 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
102 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 ...
1
vote
1answer
232 views
How do I alter the comment form 'allowed tags' text in a plugin?
I'm using the PHP Markdown plugin, and I'd like to modify it so that it adds some text to the bottom of the comment form indicating that Markdown is supported in comments.
I've been modifying my ...
0
votes
1answer
345 views
Changing bloginfo description from a plugin
How can I change the site's bloginfo description in runtime from a plugin?
I tried these, but none of them work:
add_filter('description', 'ab_arq_generate');
add_filter('blogdescription', ...
2
votes
3answers
927 views
How to change wordpress post title?
How to change just wordpress post title but not menu items.
add_filter('the_title', 'wordpress_title');
function wordpress_title(){
return 'New title';
}
-2
votes
3answers
102 views
Apply function on all action hooks?
Is there an easy way to apply a function on all action hooks?
I want to apply esc_attr() to every action hook (in a way that would work from functions.php or a plugin).
I figure I would need ...
3
votes
2answers
442 views
Display only certain posts based on visitor's country?
Is it theoretically possible to have the following feature?
Each post has a country code. When a visitor comes in, the system will determine the visitor's country code. Then when the page renders, ...
1
vote
1answer
343 views
How do I access the menus produced by Dashboard > Appearance > Menus
A continuation to this question:
Replacing WordPress menu functionality with a plugin
Since I really rarely work with WordPress (I've done a lot of work with phpBB, myBB, Concrete5, and custom PHP ...
0
votes
1answer
334 views
Why doesn't my simple the_title filter get applied?
I have added the code below to an active plugin, but it's having no effect on my posts.
add_filter( ‘the_title’, ‘myfunction’);
function myfunction($title) {
return "Why won't this work?" . ...
1
vote
2answers
73 views
Is there a Filter that I can use to filter the tags before they are inserted in to the database?
I want to filter the tags before they are inserted into the database. I'm aware of the pre_insert_term filter. But what I need to do is to see all the tags at once. I need to limit the number of tags ...
0
votes
1answer
212 views
wordpress is automatically linking plaintext email addresses
Hey guys, I'm using the latest version of wordpress (3.1.1). Is it just me, or is wordpress now automatically linking plain-text email addresses?
I type jdoe@email.com as a comment and it shows up as ...
0
votes
1answer
192 views
Can I attach a plugin via my add_filter callback contents?
I'm trying to add my plugin interface to the Category Editor. I've easily attached it to the post and page editor using the add_meta_box() filter, but there does not appear to be an add_meta_box hook ...
2
votes
1answer
944 views
Explanation of the “posts_join” and “posts_fields” filter hooks?
I'm new to the "posts_" filter hooks and wanted to know a few things from those in the know:
In this question, someone posted
an answer using posts_join that took
a second parameter of $query:
...
0
votes
2answers
345 views
Check if variable is set in filter
Thanks to your suggestions, I enabled wp_debug and discovered flaws with my plugin. I have a filter for sorting posts by votes. I use it when the sort URL parameter is on.
add_filter( 'posts_where', ...
1
vote
2answers
875 views
Conditional add_filter?
I need to apply an add_filter from my functions.php but only if the user has opened media-upload.php from my custom function. Is it possible to send a variable when opening media-upload.php that I ...
