Tagged Questions

A type of hook that provides a way for content to be overridden programatically

learn more… | top users | synonyms (5)

0
votes
1answer
13 views

Disable sanitize_file_name on upload without modifying functions.php

I am looking for a way to disable sanitize_file_name function without modifying the functions.php or formatting.php. I am uploading files that have other language file names and all I am getting are ...
0
votes
0answers
12 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
0answers
5 views

Filter get_projects_category();

Is it possible to amend the <?php get_projects_category(); ?> to only get projects from specific categories? The previous code is populating a menu with category links, and I only want certain ...
4
votes
1answer
122 views

How Can I Add a Filter to Class Instance Only?

I have a custom class which I use for several cases extending it, for example class A { public function show_things() { print_r( apply_filter( 'yet_another_filter', array( 'coffee', ...
2
votes
0answers
39 views

Wordpress Media mime type filter problem 4.0

I have added new mime types with the 'post_mime_types' filter eg. PDF, doc, mp3 etc... Filtering by custom mime type on the upload.php page in media grid view works as expected but in list view it ...
3
votes
0answers
24 views

post_mime_types Filter not Working in List Mode

I'm using the following code to add new sorting options to my Media Library: function modify_post_mime_types( $post_mime_types ) { $post_mime_types['application/pdf'] = array( __( 'PDFs' ), __( ...
0
votes
0answers
8 views

How can I append content from another given id in the current post?

I need to append the content from a couple given post ids, into another specific pages. This is what I've tried but it's not working. The goal is to append the content from posts id 1794 and 2094 ...
0
votes
2answers
25 views

Proper way to replace the_content only for pages created by custom plugin

I'm creating a plugin that needs to replace the_content of only two specific pages that it created upon activation. Here is my code: add_filter('the_content', 'emd_content'); function ...
0
votes
0answers
15 views

Removing menu item doesn't get removed on edit post

I have removed some menu links for a basic contributor role, just that when the user access the edit post section they re-appear(wp-admin/post.php?post=24731&action=edit). What am I missing? This ...
0
votes
0answers
16 views

Custom search fields and AJAX support

I am trying to rewrite the search. I used the action pre_get_posts and the filters posts_where and posts_join. The page loads with my custom filters. But I can't make it work with AJAX. How can I make ...
-2
votes
0answers
12 views

Woocommerce order status based dashboard [closed]

I created several user roles based from the shop_manager. How do you make it that each type of shop_manager is able to see orders with a particular status from the orders dashboard? Example: ...
0
votes
1answer
15 views

Replace header image on all other pages but home - URL issue

I've got a function working to achieve what I want on my dev server, but it will not work on the live site. I have a random image implemented via shortcode and plugin, and it must appear everywhere ...
0
votes
1answer
14 views

Filter seems to be run before another filter although priority is set correct

First of all I want to mention that these are my very first experiences with wordpress plugin development. In the following I describe what I want to do and then describe my problem. I wanna use ...
1
vote
2answers
24 views

wp_insert_post_data filter hook identify current action

I have this function to set the title of a wordpress post which works properly for saving / updating posts. The major issue is that the function stops posts being deleted (it removes the title but the ...
2
votes
1answer
26 views

How to use update_{$meta_type}_metadata filter to modify meta value

I'm trying to wrap my head around the update_{$meta_type}_metadata filter, in order to modify both post and user metadata before database insertion. After reading the docs and the core, it seems to ...
0
votes
0answers
34 views

Wordpress category filter update subcategory

I'm building a new theme and i need to have an option at the top where there are three dropdown fields which represent three unique categories. The three categories are basically ( Country, City, ...
0
votes
0answers
20 views

is_page_template() doesn't work with excerpt_length filter

I am tring to set a different excerpt lenght for the pages that use an specific page templates using excerpt_length filter. This is the code: add_filter( 'excerpt_length', 'nmd_excerpt_length', 999 ...
0
votes
0answers
23 views

How to make a wp_title filter hook change the title column in custom post types reliably

I have written code for a custom post type. The custom post type is loosely based on the cpt-bootstrap-carousel plugin, but only as far as functionality goes. My code makes use of the ...
0
votes
1answer
45 views

4.0 remove_filter for Wordpress core function not working for me

I was trying to overwrite how captions are embedded into a page when editing in the admin. I simply did this: remove_filter( 'image_send_to_editor', 'image_add_caption', 20); add_filter( ...
3
votes
1answer
72 views

Pass all custom fields through the same filter on post load?

Is there a way to filter all custom fields on a post? Lets assume for very basic simplicity I have: standard fields of: title post body custom fields: author ISBN quote Lets assume on page ...
0
votes
0answers
16 views

If Specified Page then Redirect Elsewhere in Plugin

There's a few parent pages that only exist for URL purposes, but the actual page themselves need to be redirected to the home page since they're blank. I'm trying to make a simple plugin that will ...
0
votes
1answer
33 views

Removing posts from the returned wp_query. Cannot use object of type WP_Query as array

My end goal is to perform 3 custom field filters on a sets of filters on a WP_Query. The difficulty arises as I need to use both AND/OR relations between the 3 filters: field1 = A AND field2 = ...
0
votes
1answer
27 views

Override email_exists function

I am trying to override the email_exists function to modify the way it works slightly. It is not listed as a pluggable function so I am unsure how to go about it. I would like thef following to ...
0
votes
0answers
25 views

Using similar CPT rewrite slug and endpoint?

I'm currently using "details" as an endpoint to divide information from a CPT with many fields across multiple views. My URIs look similar to /location/location-name/details/rates/ I've got this ...
0
votes
0answers
27 views

Remove posts inside pre_get_posts using a custom query

I need to remove posts from admin listing, if their last child post author is different than the parent post author. I was hoping to use pre_get_posts, but can't figure out how to do this. Here's my ...
0
votes
2answers
30 views

Best filter to use for modifying custom fields on a post?

What is the best filter for editing custom fields on a post? I am not actually editing the post content but some related fields. Would it be add_filter('the_content', 'edit_custom_fields');? It just ...
0
votes
1answer
26 views

How to add a custom filter in functions.php

I have been through the Wordpress codex but I can't figure out how to write a filter. I would like to use a filter called: 'wpseo_sitemap_' . $filter . '_change_freq'. It expects you to return one of ...
4
votes
3answers
152 views

the_content and is_main_query

I am filtering the content with the the_content filter. Everything works perfect, excerpt that my changes are applied to custom queries as well. My changes appear in the sidebar as well if the widget ...
0
votes
1answer
46 views

run shortcode in excerpt of single custom post type

Hi because of the way my theme is set up, I need to run a shortcode inside the excerpt of a custom post type (services). This is the code I have so far... function ...
0
votes
1answer
22 views

Change name of existing post status type

I've been googling around, and struggle to find any solutions on how to add custom post status. Id like to add 2 a new status called "unread" I've seen the codex explaining how to register a new ...
0
votes
0answers
23 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 ...
0
votes
1answer
34 views

Custom Search Template for Custom Post Types

I know this is asked a million times, and I've found the solution. It seems fairly straight forward but it's not working for some reason. I wonder if it has something to do with the fact that I'm ...
0
votes
0answers
37 views

Find field name and its applied filters

Currently, I'm trying to modify the calendar plugin in my Wordpress to accept line breaks in the field for the event's cost. I managed to remove the escape HTML functions from the views, i.e. if I add ...
0
votes
1answer
40 views

What is the earliest hook to modify post content?

I have installed a plugin that adds stuff at the end of the content. I just want to apply my modifications to the post content before this plugin does. In my case or otherwise, what is the earliest ...
0
votes
1answer
36 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
1answer
22 views

remove_action conditionally for Custom Post Type - not working

I'm using a Genesis child theme with the 'Genesis Co-Authors Plus' which enables support for 'Co-Authors Plus' I'd like to disable the author box everywhere except for the blog. Genesis Co-Authors ...
0
votes
0answers
25 views

How can I change the lost and reset password from action url?

This a second part to my original question posted via the following link How to change/rewrite the lost password url? Submitting the lost and reset password from generates a 404 because there action ...
0
votes
1answer
46 views

How to change/rewrite the lost password url?

I used iThemes Security (formerly Better WP Security) hide back-end functionality to change the login url to /signin however clicking the lost password link /wp-login.php?action=lostpassword now ...
0
votes
0answers
25 views

Wordpress Apply filter in plugin causes 500 internal error

I use the plugin https://wordpress.org/plugins/show-post-in-lightbox/ to display all feautered image of every post on a page. whenver one of these images get clicked on a lightbox will appear showing ...
1
vote
1answer
65 views

Customize the “Registration complete. Please check your e-mail.” message on WP 4.0

How do we customize the "Registration complete. Please check your e-mail." message that appears when registering on WordPress 4.0? In previous versions, Dave Ross solution worked: add_filter( ...
0
votes
1answer
41 views

How to modify only part of a function through the filter

I'm trying to edit part a function that validates user registration and I need to change the language of the error response because I modified sanitize_user() to disallow "@" and ".". So I need to ...
1
vote
0answers
30 views

Create Search Form to Filter Through Terms

I have pages that displays a list / grid view of all my taxonomy terms. Over 200 terms. The page is paginated since there are so many terms, however, I would also like to include a "search" box at the ...
1
vote
1answer
32 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
1answer
38 views

Removing URL and adding container around image in the featured image metabox

I want to remove the url and add a container(div) around the image in the featured image metabox. Wordpress output <p class="hide-if-no-js"> <a title="Set featured image" href="URL" ...
0
votes
0answers
18 views

Custom xmlrpc request does not pass parameters?

Here is what I have: function xmlrpc_login($args){ //this code actually runs var_dump($args); // is NULL ...other logic that needs the args values... } function ...
0
votes
0answers
27 views

Wordpress gallery shortcode - include author's images

I'm using the built-in wordpress gallery shortcode to display all images of a category -- documentation found here: Wordpress Gallery Shortcode Codex --- By using [gallery category="1"] How could ...
0
votes
0answers
18 views

add_filter not adding the filter

i am adding a filter at the end of my themes functions.php if( !function_exists( 'mars_widget_post_ids' ) ){ /** * @param array $query * @param string $widget_id */ function ...
0
votes
1answer
31 views

Add rel to all images in a post

I want to add a rel to all images in a post. I am trying following filter but it will wrap only the images which are in the gallery. It does not wrap the images which are added individually without ...
0
votes
1answer
34 views

How to add a filter conditionally based on page related Conditional Tags

I am developing a WordPress plugin and can't conditionally add filters based on the conditional tags. This is my code: add_Action('init', 'determine_location'); function determine_location() { $d = ...
0
votes
1answer
42 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) { ...