Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

0
votes
1answer
12 views

Custom form action hook

I am writting a simple newsletter subscriber plugin. I created a widget with form: echo '<form action="'.home_url().'" method="post" name="subscriber_form">'; echo '<p><input ...
0
votes
1answer
19 views

Is it possible to be more page/post specific with admin_enqueue_script?

I am using this code to load a stylesheet in the admin, but only on post.php related pages: function my_enqueue_for_post_pages_only($hook) { if( 'post.php' != $hook ) return; ...
0
votes
1answer
26 views

How to change home or site url using action hooks or filter?

I want to change url dynamically, so is there any way to change url? I know other methods like from admin, directly from database or wp-config. but i want to change it from either hooks or filter. ...
0
votes
0answers
27 views

Hook pages by id on static front-page

I would like to build a one page website upon the Wordpress CMS. I'm looking for a way too hook my pages on a static frontpage by id, since I have several page types. I've tried: $id=6; $post = ...
0
votes
0answers
16 views

Appropriate hook for filtering the posts from the admin page

I am currently developing a custom post type and I would like to know which hook I should use in order to filter posts by category. Can anyone please tell me how to do this?
2
votes
2answers
40 views

How to make post and comment count unclickable with dashboard_glance_items hook

I have a multi author site and I have already used some hooks to stop them from viewing other author's posts and media. Now, in the Wordpress Dashboard in the "at a glance" section it shows them the ...
-1
votes
0answers
14 views

Order Summary page in WooCommerce [closed]

Is there a hook that would allow me to do something between the checkout place order page and the payment gateway? Basically before we go to the payment page I want a summary page of what the user ...
0
votes
0answers
9 views

Automatically create featured image on post publish

I know how to make an image display IN PLACE OF a featured image if the post has no featured image, however, as far as the database is concerned, the post still has no featured image. In my theme, ...
-2
votes
0answers
19 views

How do I execute hooks only on homepage in Genesis theme? [closed]

I want to execute these hooks only on homepage . How do I do it ? I am using Genesis 2.1.2 theme . remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( ...
4
votes
1answer
29 views

Wordpress Multisite: Adding actions to only one site

I have Wordpress Multisite installed with WooCommerce network activated. I want to add an action to a hook in ONE of the sites that has WooCommerce installed, instead of all of them. For example, I ...
0
votes
0answers
15 views

Removing WP-Login inputs

I'm building a passive captcha system for my WP sites, and I'm attempting to remove the inputs (username, password, submit) from my standard WP-Login page via php hooks; they'll be replaced via jQuery ...
0
votes
0answers
33 views

Add icon near meta box title in posts/pages

I'm trying to add some "help icon" that will be use to show "help text" with the help of the tooltip or pointers to admin section. Now I'm trying to understand how can I add in the posts/pages in ...
0
votes
1answer
21 views

Use an array of page template slugs and $hook

I'm using the function below to load some javascript that removes the checkbox in the User Profile that is used to toggle the Visual Editor: //Remove Visual Editor option in User Profile function ...
0
votes
1answer
17 views

How to add a class to Buddypress avatars in the Activity stream? [closed]

I'm in the process of trying to integrate bootstrap with Buddypress and am trying to add a class of "media-object" to Buddypress avatars. I could do this by mimicking the Bootstrap CSS, but in the ...
1
vote
1answer
22 views

Filter Posts from the Main Query

I want to conditionally merge a custom post type with my posts post type, based on a custom field. If the field's value is 1, then I want I need those custom posts to appear in the same loop as posts ...
0
votes
1answer
27 views

Plugin Hook: Get posts

I am building a WP plugin. It shows several featured post images with titles atop. It will have a spot on the admin bar to tell it what the featured posts are. What hook do I use to get the post's ...
0
votes
1answer
14 views

New User Save Filter

I'm using the new(ish) filter add_action( 'user_new_form', 'funcy', 9 ); to add custom fields to Create A New User page. I'm then using add_action( 'personal_options_update', 'save_user_meta' ); ...
0
votes
0answers
17 views

URL mod rewriting for my custom links

My Actual link :- http://nanhai.com/nanhai-overview/162/ I want it like :- http://nanhai.com/nanhai-overview/xyz/ My code add_action('init', 'add_actor_url'); function add_actor_url() { ...
1
vote
2answers
69 views

Wordpress auto login after registration not working

So I looked up a bunch of threads trying to figure out how to automatically log a user in after registration, and came up with this. function log_me_the_f_in( $user_id ) { $user = ...
0
votes
1answer
18 views

get_the_post_thumbnail not working inside wp_get_nav_menu_items hook

if ( ! is_admin() ) { add_filter( 'wp_get_nav_menu_items', 'display_last_posts_for_menu_item_ts', 10, 3 ); } function display_last_posts_for_menu_item_ts( $items, $menu, $args ) { $menu_order = ...
1
vote
1answer
17 views

Wordpress capabilities and restricted categories access

I've a Wordpress blog to share content with some people only. Users has to login to access this website. I created new roles and new capabilities on this blog. I've got some articles which belongs ...
0
votes
0answers
27 views

Hook before & after plugin / core update

I'm working on a maintenance plugin for my website and I want to enable it before plugin/core upgrade starts and disable it after plugin/upgrade ends. Any ideas ? Thanks! :) PS: all I know is I can ...
1
vote
0answers
91 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
1answer
21 views

Which method to use when deleting posts from the front-end

I am trying to enlist all my posts on the front-end along with delete and edit links (using the shortcode API). I am having difficulty with the delete links. To me the most obvious way to handle ...
1
vote
2answers
25 views

apply_filters/do_action tag characters limit

Does apply_filters/do_action $tag name have a characters limit? Can be any problems if the tag name is way too long? I ask this because I know that WP transients have a limit of 45 characters. FYI, ...
0
votes
1answer
22 views

Add_menu_page() error message -> “You do not have sufficient permissions to access this page”

I'm currently building a website for a friend and have assigned him the user role of editor. I don't want to give him an administrator role in case he breaks the layout. Anyway, I am using ...
0
votes
1answer
36 views

get_post_meta not working inside a function in functions.php but works outside

function notify_new_posts($post_id) { $keyval = get_post_meta( $post_id); $buyer_wdistance = get_post_meta( $post_id, 'cf_wdrive'); //$buyer_wdistance = $keyval['cf_wdrive'][0]; ...
0
votes
1answer
41 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 ...
1
vote
1answer
20 views

How to modify how the_content outputs a link to an internal page

I like the default add link dialog in the wordpress editor. IT allows for easy linking to internal pages. I need to modify the output of those internal links. Right now its outputting: <a ...
0
votes
1answer
32 views

Retrieving post ID from current page

I am following the tutorial here. Wordpress Ajax is a bit complicated but this tutorial helped me out a bit. The only question I have is, when I view any page, I want to be able to get the current ...
0
votes
1answer
26 views

$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query. add_filter('the_posts', 'query_variation'); function ...
2
votes
1answer
71 views

Security around save_post hook

There are a lot of examples using the save_post hook, that include adding and verifying a nonce, and checking the user has appropriate permissions before you continue. Is this necessary? When ...
0
votes
3answers
42 views

register_deactivation_hook argument -> pass arguments in the selected function

I've been looking for minutes how to pass arguments in the register_deactivation_hook as follow : register_deactivation_hook( __FILE__, array( new Cpt, 'delete_cpt') ) ); class Cpt { /** * ...
1
vote
1answer
21 views

Howto check version of another plugin and then add a submenu page to it

i'm writing a plugin which requires another plugin. So i have to check first if the other plugin exists in a correct version. If yes i want to add a submenu page to the plugin page but here my code ...
0
votes
2answers
44 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
1answer
51 views

Hook into $wpdb

Is there a way to hook into the WPDB instance ($wpdb)? What i basically want, is to execute a own function BEFORE the desired query get's executed. Is this possible? Additional question for comment ...
0
votes
1answer
115 views

Ajax +wordpress onClick link redirect to new page and create html content

i have two pages in my wordpress plugin index.php charts.php in index.php i have some content and some link.. <a onclick="show_trend()" >Trend</a> while clicking this link ,i have ...
-1
votes
1answer
68 views

WooCommerce New customer email Hook? [closed]

I've created a sign up page for new customers to create an account. This is working fine but I would like to hook into WooCommerce customer_new_account inside ...
0
votes
0answers
16 views

Meta query not working with pre_get_posts

This works $q->set('meta_key', 'available-date_%_from'); $q->set('meta_value', '20140701'); This doesn't $q->set( 'meta_query', array( array( 'key' => 'available-date_%_from', ...
0
votes
1answer
24 views

How to hook watchdog script for existence of a WP page?

I would like to have a watchdog script which checks the (un)availability of a certain DB entry, namely a certain WP page. The script itself is absolutely independent from WP and not difficult, but I ...
0
votes
0answers
13 views

check_admin_referer always false when I use on add_action('load-'* hook

I have try to add hook on load my plugin page. But every time i save my config, it always return "Are you sure want to ..." message. Is there something i missed? Here's my code: <?php class ...
0
votes
0answers
27 views

Using 'add_attachment' to add taxonomy term on upload completion?

function amend_gametitle_upload( $game_title ) { global $post; if ( isset( $_REQUEST['post_id'] ) ) { $post_id = absint( $_REQUEST['post_id'] ); $post_obj = get_post( ...
3
votes
2answers
139 views

Adding function directly vs using hook in function.php

We can use functions like register_nav_menu() directly in function.php and it works and we can also use a function to put register_nav_menu() inside of it and attach that function using a hook like ...
0
votes
1answer
33 views

Get new (not old) post inside transition_post_status hook

Following up the ticket 'transition_post_status' is executed before 'save_post', I'm still struggling how to access the new $post (after it has been saved) inside a transition_post_status hook. Right ...
0
votes
0answers
31 views

Checking if some condition is matched before inserting post into database

Is there a way to check if some requirements are matched before adding new instance of custom post type to database? Like custom policies for adding new posts etc? What I want to do is to build two ...
2
votes
1answer
218 views

How and why can a hook call itself without causing recursion?

When looking in WP hooks' code, I often see hooks that call themselves. For example, this snippet from image_downsize(): function image_downsize($id, $size = 'medium') { if ( ...
0
votes
0answers
15 views

Ask for template when adding a new page

I would ask the admin which template they would like to user when they click on "Add New" Page. Is this possible? I think I have seen something similar before where it ask you how many columns you ...
0
votes
1answer
40 views

Dynamically Generate Functions and Hooks

I'm trying to find if it's possible to dynamically generate functions and hooks. All functions do the same thing, and all hooks are essentially the same. Here's an example of a hook/function combo: ...
0
votes
0answers
26 views

get_plugins() doesn't work after plugins_loaded

Any idea why the following code function my_plugin_load() { get_plugins(); } add_action( 'plugins_loaded', 'my_plugin_load' ); Throws this error? Fatal error: Call to undefined function ...
0
votes
1answer
17 views

Hook on creating a menu entry?

I need to run some code after a new item has been inserted into a WordPress nav menu. Is there any hook on menu modification or something similar?