1
vote
1answer
29 views

Is it acceptable to treat a filter like an action?

The wp_insert_attachment_data filter is available inside wp_insert_attachment(). It allows attachment post data to be filtered before it is updated in or added to the database. $data = apply_filters( ...
0
votes
0answers
11 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
19 views

Adding to an array & passing it through do_action/apply_filters

For exercise I am working through a PHP class to add meta boxes I found on GitHub. I just copied the code and now I am playing around with it to understand it. It works like this: The file ...
2
votes
2answers
47 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 ...
0
votes
0answers
22 views

Stop a specific plugin from executing based on product id in cart

I am trying to stop a specific plugin from executing based on product id in cart. However i can't seem to get it running. There are a few places where i want the plugin to stop inserting its function. ...
0
votes
0answers
28 views

Filter WP_Query output before it is accessed (pre_get_posts)?

I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it. I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is ...
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 ...
1
vote
1answer
33 views

How do I add Bootstrap and LESS to my migrated WordPress site?

I'm migrating a website to WordPress - it uses both Bootstrap and LESS. I found a snippet online for enabling Bootstrap and the outputted CSS via functions.php: function theme_add_bootstrap() { ...
0
votes
0answers
17 views

Autogenerated Title for Custom post type loses title when trashed/deleted

I am generating title for a custom post type using the following code. It takes the $fname, $mname, and $lname values and generates a title based on the post. This works fine for custom post creation ...
1
vote
2answers
27 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
0answers
31 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; ...
2
votes
1answer
39 views

What's the best way to split admin-only functionality in the theme's functions.php file?

I am customising a Wordpress admin area and so far so good with a number of add_filter and add_action calls in my theme's functions.php file. But I'm a bit worried because all this code will be ...
0
votes
1answer
23 views

Hook into 'when user logs in' [persistent login]

I'm trying to create a persistent login mechanism in Wordpress (I can't find a plugin, but if there is one, let me know!). But I'm struggling to find a hook (add_action or add_filter) that runs when ...
0
votes
0answers
33 views

Wordpress Unit Testing cleaning up hooks and filters

Using Wordpress' unit testing suite has been going quite well, and it's nice the WP_UnitTestCase takes care of cleaning up table data after each unit test. But one thing that doesn't seem to be ...
0
votes
2answers
82 views

Create new custom post and post category of same name

I have a custom post type "Product" and want to create a post category "A Product Name" automatically on creation of a new Product so that the post category (not custom post category) would have the ...
3
votes
1answer
93 views

Using hooks to place content in theme dynamically

Alright, so I think I may be getting a little too complicated on this, but I basically want to know if this is possible. I am using a content slide function where I display some thumbnails within the ...
0
votes
1answer
78 views

Return a custom value in a function added to an action hook

I looked into the difference between action and filter hooks, and as far as I understand, it is not possible to have a function, which is added to an action hook, return a (custom) value. My ...
0
votes
0answers
63 views

External Script Using WP - Hooks / Actions Not Working?

I've researched this problem in depth, but still stumped. Simply stated, I have an external uploader script which loads WP. Yet I cannot seem to grab any of the actions/filters I've put into it. Why ...
1
vote
1answer
173 views

Remove “Get Shortlink” button in admin of custom post type

I want to remove completely this section under my title in my custom post type. (I don't need this because I use this only for content management). With this piece of code I can remove the ...
1
vote
0answers
88 views

How to customize the “Insert/edit link” popup box?

is there a way to customize the "Insert/edit link" popup box in the editor so that it does something like this: Have a checkbox that says "Insert affiliate tag at the end of link" If the checkbox is ...
0
votes
1answer
30 views

Redirect after post deleted

On the single template, I am using a delete post link generated by the get_delete_post_link function. When I use the link to delete the post I am currently on, it adds a query string of ...
0
votes
1answer
68 views

the_posts filter been called multiple time

I have create an endpoint so I can do some checkout processing of my cart. Everything is working fine in sense that every thing is hooked up properly. Though I am having issue that to serve the ...
0
votes
1answer
38 views

Custom registration field to SQL database

I have created new columns in a SQL table called wp_users. Those fields are "giodo", "handel" and "regulamin". What I want to do is to add '1' to each column when a user registers and selects ...
7
votes
2answers
161 views

Remove Actions/Filters added via Anonymous Functions

That's a freaking bad practice I must say. Spent last two hours finding a solution to remove actions and filters added via Anonymous functions. This is the code used on a Parent Theme, and I need ...
0
votes
1answer
209 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
1answer
50 views

change output location of plugin function using a custom hook

I'm running the YouTube Video Fetcher plugin and it fetches youtube videos and displays it on your website. However, instead of displaying the video after the post, I want to hook the code into a ...
0
votes
2answers
61 views

Override the Wordpress core function wp_referer_field

I'd like to override the core Wordpress function wp_referer_field to change the value of $referer_field variable inside of it. I've found that wp_referer_field is not pluggable and that I need to ...
0
votes
0answers
114 views

GET form action. Redirect to self

I'm writing filter for posts by category on author page. I send category name in $_GET array in this form: <form action="" accept-charset="UTF-8" method="get" id="form1"> <select ...
0
votes
1answer
33 views

Updating User Profile on Registration

I am having trouble getting WP to update a custom profile field when a user registers. Adding the fields works fine. Nothing is inserted into the depositAddress profile field when a user registers. ...
0
votes
1answer
92 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
1answer
26 views

Is this correct usage of filters in WordPress [closed]

I am building a plugin and I'm getting doubts whether the code I am using is the correct way of doing things with regards to WordPress hooks and filters. The scenario is that the code at a particular ...
4
votes
3answers
147 views

How to restrict actions and filters “properly” by conditions

Which one is correct when adding actions/filters/etc.... Both methods work fine and I've seen people do things both ways, but I'm assuming one is correct. My gut tells me that wrapping the if ...
0
votes
0answers
64 views

How would I remove an inline googleAPI font script in the the parent theme header.php?

Is there any way to remove the function call to the googlefontapi font in the parent header.php file besides copying the parent header.php file to the child theme and then overriding it and delete the ...
0
votes
1answer
46 views

What is the action or filter for adding information under the Permalink in Edit Post/Page?

I would like to add some HTML under the "Permalink:" in the Edit Post/Page page. Under here: So what is the action or filter?
1
vote
1answer
103 views

Filter or action hook to insert content on admin pages before </body> tag

I am developing an administrator plugin and want to be able to write some HTML content just before the last body tag . This content will initially be hidden then displayed with javascript when a user ...
0
votes
1answer
92 views

Proper after_setup_theme and wp_head cleanup

Im trying to clean up code in my theme a little bit, remove some of the code that is not used and basically do things the right way, to decrease load time etc. Currently I have this code: ...
0
votes
1answer
41 views

Display taxonomy with a maximum number of letters

I'm looking for a function which displays a post's taxonomy with a maximum number of letters. I've achieved with title (How to limit the max number of characteres in the title that are displayed), but ...
1
vote
2answers
69 views

How can i do something after head like adding a hook for after head but before post

What i mean is i am trying to add breadcrumbs to my blog and i thought of adding it before content or after title but there's an issue with that - on archive pages or category pages the breadcrumbs ...
0
votes
0answers
24 views

Filter for modifying image on upload

So I'm working on building a new WordPress plugin for massive PNG compression, and I'm having a hard time finding the right filter to hook in to. I need to access the entire image so that I can open ...
0
votes
0answers
20 views

How can I update the role of a newly added user when displaying the registration form with a shortcode?

Basically I have a shortcode that includes a registration form(among other things). The custom form itself is also included on wp-login.php and user-new.php if the default role is set to ...
0
votes
0answers
56 views

Suppress the_content filter in a nested loop

I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either: Pass data to the filter so that it knows if it is a ...
0
votes
1answer
61 views

Is it possible to track down Actions and Filters?

As far as I know using Actions and Filters hooks is the best approach for developing on WordPress. I have just to ask if there is any way to track down which Actions and Filters are applied on ...
0
votes
1answer
59 views

Making an add_filter() call from within an add_filter() call

I am creating a plugin where I am checking for parameters passed in the url for a page, then using the values of those parameters to change the Title, meta tags and make some other SEO changes. But I ...
0
votes
0answers
56 views

How do I turn off local pickup for a specific shipping category?

Can anybody provide me with some code that would help? I need to be able to offer flat rate shipping AND local pickup for all product categories apart from 2, which I have assigned to a separate ...
0
votes
1answer
70 views

cant output grayscaled ive created using add_image_size

I am trying to create a gray scaled image of the image i upload. I have been able to upload the image and create the gray scaled version by using this code: ...
0
votes
1answer
32 views

Plugin default settings hook

I am writing a plugin where I want it's default settings to change in accordance to the theme that is selected. I have it working, but would rather provide an action hook for this instead of writing ...
0
votes
1answer
188 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
2answers
31 views

How would go about if I just want a temporary function?

How would go about if I just want a temporary function? (It's a converter just for converting Access to Wordpress tables). I want to execute several times so therefore I want it automated, but I don't ...
2
votes
2answers
1k views

Advanced Custom Fields and Yoast SEO keyword analysis [on hold]

The problem I'm having is the keyword page analysis tool doesn't read my custom fields so I am trying to figure out how to run a filter on them. I found a blog post on Yoast website here here which ...
0
votes
1answer
104 views

alternative to the_content filter

"i am using the_content filter on the category pages like cat=1" I am appending --N in the content. But due the the theme functionality it strip the content after some number of characters therefore ...