Tagged Questions

Method by which plugins and themes extend core WordPress functionality.

learn more… | top users | synonyms

0
votes
0answers
8 views

WordPress - Pass A Value From Outside To A Plugin Variable

Is there a way to pass a custom variable value from outside like from functions.php to a plugin's variable? Lets say that I have the following function defined in a plugin. function plugin_funct(){ ...
1
vote
1answer
70 views

Searching hook to set cookies before <head> and avoid “headers already sent”

I have written a plugin that sets cookies, and need to avoid the "Headers already sent" PHP error by placing the code at the very top before the head section. Themes usually place wp_head just before ...
-3
votes
0answers
15 views

Add on for plugin written completely in javascript

I'm writing a plugin with Backbone.js. I plan to distribute it under freemium model. But how'll I build addons for it? Because the only PHP code I have is the AJAX handlers.
0
votes
1answer
19 views

Creating customized php files in theme folder

I am developing a e-commerce theme that requires an order page. I created a php file inside my theme folder named order-page.php and hope to access this page from the wordpress root url ...
1
vote
2answers
31 views

Fatal error: Class not found in

I am working on a plugin for 'hooking' an extra payment provider into a checkout system. I have a class gtpCheckoutData in my function.php which calculates the prices. In my plugin I want to use ...
0
votes
0answers
14 views

what is hook for handle woocommerce my-account details? [on hold]

I need to add custom user fields for the customer account. The customers are allowed to changed the data at their account page. I am using the my-account template to create the custom field. I can ...
0
votes
0answers
24 views

Which one is best practice? Hook after or before function? [closed]

I see in many tutorials that developers have different preferences on placing hook using add_action() or add_filter(). Some of them place hook after a function like this: function do_some() { // ...
2
votes
1answer
50 views

Am I using the right hook for removing quicktags on the admin TinyMCE?

This is more of an excercise than something for a client. Anyway, I'm trying to disable the quicktags when you're on the dashboard and you click on Comments > Edit Comment. On that screen, there's a ...
0
votes
0answers
21 views

How to hook add_action('user_register', 'my_functon') only when manually adding?

I stumbled upon the following. In functions.php i have a hook which calls a function when a new user is registered: add_action('user_register','do-my-function') This works, but i have also a plugin ...
3
votes
2answers
62 views

Is there a hook or function I can use to display all theme files being used on a current page?

Basically I want to be able to see the names of files on the front-end - not just templates e.g. category/page templates, but the actual theme files like header.php/sidebar.php/footer.php and so on. ...
0
votes
1answer
35 views

How to enable visual editor when editing comments on the dashboard?

For editing a comment in admin pages the editor is only html, can we modify the edit comment page with a filter to include visual editor too?
0
votes
1answer
19 views

Hook into wp_head(); in a plugin

I am following a tutorial that requires I put this code above wp_head(); <?php $example_position = get_theme_mod( 'logo_placement' ); if( $example_position != '' ) { switch ( ...
0
votes
1answer
16 views

Accepted arguments value in hook functions

Let's say I have the following hook function: function my_function() { $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; if( !isset( $_REQUEST['mode'] ) ) $_REQUEST['mode'] ...
0
votes
0answers
21 views

save_post is not firing when I only edit custom meta fields

I've come across the action hook save_post few days back and I like to take advantage of it. I've custom post post type "Property" with Meta fields associated with it. The problem is that when I ...
1
vote
2answers
50 views

How to override WordPress registration and insert an auto-generated username?

I need to auto-generate usernames upon WordPress registration. I have a custom registration form set up and would like to create the username in functions.php. Can someone tell me why this isn't ...
2
votes
2answers
66 views

How to hook into the CPT's title placeholder?

I want to change the default placeholder text in my Custom Post Type title field. This isn't possible while registering a new post type. The following screenshot describes it.
0
votes
2answers
30 views

How do I hook my function to run only after submitting login form

I'm new to wordpress. I'm writing my first plugin. I don't understand how to have my function run only after submitting the login form while not running every time I refresh the login page. I tried ...
0
votes
3answers
47 views

Categorise Custom Post Types

I don't want to add the category support for the posts of a certain custom post type but to categorize the post types itself. How is that possible? Story behind: In my theme I handle different post ...
0
votes
1answer
35 views

Please explain me what the do_action does

I am trying hard to understand do_action but not understanding. I was studying the blane theme. And they have this code in sidebar.php <div id="secondary" class="widget-area col-md-3" ...
0
votes
0answers
16 views

Override an advanced custom fields action callback [duplicate]

I'm in the process of writing a CDN plugin for WordPress and am trying to integrate it with the Advanced Custom Fields plugin. I need to filter the output of the "File" field type on the edit post ...
0
votes
1answer
24 views

Use a variable created in get_header to calculate stuff in wp_footer

i am trying to create a small time tester that loads at get_header hook and the using the value does something in wp_footer... i have tried using global $var i tried putting the global var inside ...
7
votes
1answer
55 views

Add a new tab to Wordpress Plugin install Listing

When an user searches for a plugin from the WP Admin's Add Plugin area, I want to add a new tab(with a link to a page) next to the current tabs. The location where I want the link is marked in the ...
3
votes
1answer
47 views

How to add a link to Wordpress Plugin install Listing

When an user searches for a plugin from the WP Admin's Add Plugin area, I want to add a link/button to every plugin's listing area. Which hook should I use? The location where I want the link is ...
0
votes
0answers
18 views

Add row counter in Admin area - Custom post list

Hi I add some custom columns to my custom post type listing in admin area. In my functions php: function book_cpt_columns($columns) { unset( $columns['date'] // Ocultar columna ...
0
votes
1answer
21 views

Add custom message to the plugins page of Wordpress

I'd like to add a banner at the top of the plugins page (where you update plugins) that reads "Please do not update plugins". I know I can use the admin_notices hook to attach the message, but how do ...
0
votes
1answer
24 views

Where is publish_post hook fired?

Hook publish_post, which does not necessary need to be run on post publishing only, it can be used for any post type and any post status in this format {status}_{post_type} which also makes it hard to ...
0
votes
0answers
24 views

How to apply hook on pre_get_posts go get natural sort in listings in dashboard?

I have this code to do sorting on meta_key e_nummer ascending order in admin dashboard when listing products. /* Sort posts in wplist admin by e-nr! */ function custom_post_order($query){ ...
0
votes
0answers
92 views

admin-ajax.php not working after wordpress 4 update

n WordPress 3.9.2 access to admin-ajax was working for non loggedin users. When I upgraded the script stop working. I have the following code in functions.php function theme_name_scripts() { ...
0
votes
1answer
28 views

How to initialize something in unit test before the init hook being called?

I've a simple PHP Unit written for WordPress and want the initialize code before the main 'init' action being called from the plugin I want to test, e.g. class MyPlugin_Test_Example extends ...
0
votes
1answer
26 views

“Seen by” Feature in posts [closed]

Do you guess how would be a good practice to achieve a "seen by" feature in every post? I mean, simply add which users have seen a post. I'm not sure how to add a hook for that. Neither if I would ...
0
votes
0answers
13 views

Override child theme menu to social menu

I have a header.php file contains these code supreme_primary_navigation(); do_action( 'after_menu_primary' ); and functions.php file contains these code function supreme_primary_navigation(){ ...
3
votes
3answers
176 views

wordpress hooks run sequence

What is Wordpress HOOKS execution consequence? I mean, i want to know the order, how add_action hooks are executed (i.e. init after_theme_setup wp_header and etc.. i want to know the correct ...
0
votes
1answer
41 views

Hook when adding or editing a specific custom post type? [closed]

I'd like to insert a script and if possible some PHP for a custom post type. I'm looking for a hook to do this on the add new or edit screens. Any idea what I'd use for this? I tried "edit_post" but ...
1
vote
0answers
15 views

put custom taxonomy slug in front of their respective term slugs

I needed to register two custom taxonomies which partly share some terms. The structure would look like this, when commerce and crafting are two different custom taxonomies: Commerce Furniture ...
0
votes
0answers
25 views

Add notice to add image popup

I have been using the global "pagenow" variable to add instructions for users, but I need to somehow hook into the add image popup as I would like to instruct the users on optimal resolution for ...
1
vote
1answer
51 views

Conditional hook [closed]

Is it possible to have a conditional hook in my child theme function.php? This is because I only want a certain hook to execute when a certain criteria exists. I have tried doing the following code ...
0
votes
1answer
40 views

Bind a function with its own argument to show something dynamically after every content

I have a function that is grabbing something from database using a user-defined ID. I need to show the content after every post/page content. So I followed @s_ha_dum's solution from WPSE, like below: ...
0
votes
0answers
14 views

Comments closed only for contributors

I am having a very funny issue right now. My WordPress is currently with comments activated and it always worked, but now that I've opened the website for contributors, only their posts are coming ...
0
votes
0answers
20 views

Get post titles shows on single posts

I want to display this link lists in "single post" only. How to do this? add_action( 'genesis_before_footer', 'radiolink_unit', 1 ); function radiolink_unit() { ?> <div id="languagelinks"> ...
0
votes
2answers
39 views

Call Web Services on post first publish

I want to call some web service when i publish a post. I want to add a checkbox so as to decide whether to call or not call after publishing. I have found the code to call both REST and SOAP web ...
3
votes
1answer
66 views

Is it possible to save/modify a post without calling the “save_post” action hook?

There is a save_post hook that is run when you save a post. In fact, revisions and autosaves also call this hook. Even if you simply change the status from published to draft it triggers the save_post ...
1
vote
1answer
34 views

Are posts updated or built from revisions + autosaves?

When editing a post in the admin I see records being added to the database to document my changes (here is part of the hooks I'm logging): ... http://local.dev/151-autosave-v1/ clean_post_cache ...
0
votes
0answers
16 views

comment_post and preprocess_comment connected

In my comment_form arguments i add a input label with a value: 'comment_notes_after' => '<div id="canvasDiv" ></div> <script type="text/javascript"> ...
0
votes
1answer
42 views

Admin first hook that outputs HTML?

I think load-(page) is the first hook in the admin screen that deals with outputting HTML, but I'm not totally sure. Basically I'm looking for the equivalent to template_rediect or get_header, which ...
1
vote
1answer
29 views

Add parameter (time) to oembed

I need to add a time parameter to the YouTube oEmbed callback. This time parameter should be set via URL. I found various answers which describe how to hook into the oEmbed callback, but none of them ...
2
votes
1answer
68 views

How to modify an add_action() inside a loop of core function

Ok I want to edit bp_core_screen_signup() is which is a function of buddypress that used to process the registration form. Basically this funtion checks for any errors produced and then loops through ...
1
vote
0answers
38 views

Get log of function/method calls made by do_action() on WordPress initialization

Is there any way I can get a log of the method calls that are made when do_action( 'init') is fired?
0
votes
1answer
58 views

change attachment custom field onChange event

The form is in post creating window. Ajax is posting values, but the values doenst renews. Where can be problem ? Ajax <script> function dynamic_Select(field, aid, value) { ...
0
votes
0answers
22 views

attachment custom values are'nt inserted to database

I have created attachment custom field. After I uploading image and inserting to new-post.php (post creating window) no meta values are saved in database. Even that I have set a default value for ...
0
votes
1answer
28 views

A good hook to check authorization and redirect?

It seems strange to put a redirect in a template page, because so much of the page has already been built by the time you reach a custom page template. I'm wondering what is a good action hook to use ...