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

learn more… | top users | synonyms (5)

0
votes
2answers
26 views

Add Filter to get_next_posts_link

As we see in the source, we can apply filters for $attr. So I create something like this function asdff(){ return 'class="iamclass"'; } add_filter('get_next_posts_link', 'asdff',10,2); or ...
0
votes
0answers
29 views

Filter User Query

I am using the code below to display all of my users on the front end. <?php $args = array( 'meta_key' => 'last_name', 'orderby' => 'meta_value', 'order' => 'ASC', '...
0
votes
1answer
55 views

Shortcode to eliminate <p> and replace </p> with <br>

I have a filter that removes opening p tags and replaces closing p tags with a br tag sitewide. The client would like this filter in a shortcode that they can use only on specific portions of the site....
3
votes
2answers
1k 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, ...
0
votes
1answer
186 views

the_content filter together with require_once returns 1 instead of the content of the included file

It's a weird problem that looks like to have something todo with the WP SEO plugin from Yoast. If I disable it ( and no other plugins are running ), the output is what I expect it to be. It shows the ...
3
votes
1answer
51 views

Save Filter for Taxonomies

I want to get rid of undesired HTML, mostly being published by my editors when copying text from other sources, like other pages or from Word Therefore I use add_filter( 'content_save_pre' , '...
2
votes
2answers
89 views

do_action and hook methods

I am trying to understand how hook methods work in WordPress. I understand that when do_action is called WP looks for all registered listeners and invokes them according to set priority. How does ...
0
votes
1answer
30 views

tiny_mce_before_init: 'exact' => true has no effect

For a custom theme, the editors want to be able to select three different font sizes in the post editor. I thought about using a standard font size plus defining two extra classes: <p class="...
1
vote
2answers
72 views

Shortcodes not resolved in AJAX call response

I have a simple function, which returns the content of a page with the given pageID: function get_page_content(){ $id = $_REQUEST['id']; $page_data = get_page($id); echo ...
0
votes
1answer
34 views

Grouping and paging CPT events by month with custom field date

$start_date = date( 'ym01' ); $end_date = date( 'ymt' ); $meta_query = array( 'key' => 'event_date', 'value' => array( $start_date, $end_date ), 'compare' => 'BETWEEN',...
0
votes
1answer
33 views

How to use apply_filters?

So I am using a plugin which loads next posts as the user scrolls down in the single.php file. Inside the main php file of the plugin, there is something along the lines of // By default, don't ...
0
votes
0answers
14 views

Realtime filtering of posts in blog view

I'm looking for a way to filter the list of posts by a search term. For example: There are 20 postings on the blog in total. In a search field you can enter a term and without loading a new page you ...
7
votes
3answers
353 views

How can I modify the WordPress default widget output?

I don't want to style the default widget with only CSS. I want to display the default 'Categories' widget content with my own HTML structure. Is there available any filter or hook to do that?
0
votes
2answers
50 views

Disable resizing of gif when uploaded

Animated gifs are getting more popular on the web (again) and currently there is no good tool for resizing animated gifs. So I want to disable resizing/generation of image sizes for the gif mimetype ...
0
votes
1answer
15 views

Add a filter to an action [closed]

I feel like this is a really simple question, but I can't seem to find anything. I want to add a filter to an action, so I can run preg_replace on it to add a class to a link. The action is: ...
2
votes
1answer
30 views

Is there a filter hook that I can use to change how taxonomy term names are displayed?

I need to hide a custom taxonomy's terms' names on the frontend while preserving them on the backend. Instead of the terms' names I need to display pseudonyms. I can't find a single filter hook to do ...
15
votes
6answers
8k views

single-{$post_type}-{slug}.php for custom post types

My favorite part of the Wordpress template hierarchy is the ability to quickly create template files for pages by slug, without having to edit the page in Wordpress to select a template. We can ...
0
votes
1answer
30 views

Hide Admin posts & pages in Dashboard

Is it possible somehow to hide Admin's pages & posts from dashboard so that other users will only view/list non-admin publications?
2
votes
1answer
37 views

return values from hooks do_action and apply_filters, which is better

Myself wondering among the following methods which is better to update an option value where value to be updated is coming from an ajax callback. Since Wordpress Codex clearly says apply_filters is ...
0
votes
0answers
18 views

How to Modify all of an action outputs

There's a plugin in my site that allows to introduce extra information with the following action call: do_action( 'bp_before_member_header_meta' ); Another plugin adds some of it with add_action: ...
0
votes
1answer
1k views

How to apply filter at search of woocommerce products?

I want to change woocommerce search. And want to limit the search to Product title and Category and Tag only excluding description and short description. Search Form is in plugins/woocommerce/...
2
votes
1answer
46 views

add_filter priority problem

I'm using basic user avatars for use local avatar in wordpress. And i have a simple function in my functions.php for getting avatar direct link. My problem is if i use get_avatar function in my ...
1
vote
1answer
22 views

Amend wordpress password function

I simply want to add a H2 or whatever html tag above the content in this password protection function. Is this correct? function my_password_form() { global $post; $label = 'pwbox-'.( empty( $...
0
votes
1answer
24 views

Hook for plugin to show content for certain urls

New to WP development. I want my plugin to dynamically show content for certain urls, for example, when the user navigates to /my-plugin or /my-plugin/key, my plugin would provide the content. The ...
3
votes
2answers
42 views

add class to term_description

trying to filter the output of term_description to include a class https://codex.wordpress.org/Function_Reference/term_description function add_class_to_term_description() { ?> <?php echo '&...
6
votes
2answers
208 views

Insert Custom HTML After Shortcode

The scenario is that I need to add an HTML banner under a slideshow which is a shortcode in the homepage content. I personally hate adding a bunch of div tags to the TinyMCE editor so I'm trying to ...
0
votes
2answers
65 views

How to alter local query, not main query [duplicate]

I've done a wp_query in a shortcode. So, in page xyz I've two wp queries, one is the main query, and other's mine. The SQL query that I got from the query doesn't fit my desired affect. So I need to ...
10
votes
2answers
203 views

Add custom options to the wplink dialog

I managed to add a custom option-select for images with function attachment_field_credit( $form_fields, $post ) { $field_value = get_post_meta( $post->ID, 'first_image', true ); $...
1
vote
0answers
70 views

Sorting a specific taxonomy by archive date using URL

OK, so I'm looking for a way to sort a specific taxonomy by archive date using the site URL. Say the custom taxonomy ("sort") value is "fruit" then then you would currently get all the posts marked ...
6
votes
1answer
554 views

Modify links when inserted by WYSIWYG editor

Is there any possibility to hook into the editor of WordPress so that if a link to an internal content is inserted via the WYSIWYG editor the post id of that linked post is added as a data attribute ...
0
votes
1answer
18 views

Adding user filter - Not updating data in URL

What I am trying to do I am trying to add a filter option by adding a dropdown menu that i have hooked onto restrict_manage_users, so i can filter users by a specific meta value. My problem When i ...
4
votes
2answers
44 views

Filtering comment permalinks when a condition is met

I can't figure out how to filter the comment permalink on certain WP page that I use like this: if(condition is met) { (filter the comment url) } ...so that all the comment permalinks inside the ...
0
votes
1answer
24 views

How to store a number (coming from cookie) into query vars for later usage in other filters?

I have a small HTML5 game playable (as "canvas") at different social networks, which sets an HTTP cookie. When a player comes to my Wordpress site (acting as help and support website for the game), I ...
3
votes
4answers
12k views

How can I edit post data before it is saved?

I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they ...
1
vote
1answer
39 views

Change Page's <title> Tag Using functions.php File

In my child theme's functions.php file, I'm trying to change a page's title tag: function custom_title() { return "Page Title"; } add_filter( 'wp_head', 'custom_title', 9999 ); The code above ...
1
vote
1answer
44 views

Filter out comments with certain meta key/s in the admin backend

Not long ago I learned how to add and filter comments on posts/pages with certain meta key/value and it works fine now. Now what I want is to do two things on the backend (/wp-admin): Filter the /wp-...
1
vote
1answer
38 views

How to filter content for specific content variable

I created a plugin that adds content from another post, and places this content next to the original content. I can say, that this content should appear at the bottom of the original post content. I ...
0
votes
0answers
14 views

How do I let users specify interests on signup and have this reflect content displayed on homepage?

I'm looking for something that will allow my site to have the following functionality: A user creates a login for my site. When creating a username and password, they also select from a list of ...
0
votes
1answer
21 views

How to sort posts according to meta value?

How can I sort all the posts according to their meta value? I am using the below code: $args = array( 'meta_query' => array( array( 'key' => 'wpcf-stream', '...
2
votes
1answer
1k views

How to filter a dd/mm/yyyy date from a custom field in a query

I'm trying to build a query in order to sort some posts by a date custom field, where the dates are formatted dd/mm/yyyy. It works by querying the database directly with get_results like in this ...
0
votes
1answer
36 views

Get_template_part inside filter?

Is it possible to remove gallery from content but in its place do get_template_part('content-gallery'); ? I have this piece of code which removes gallery from post but I am inserting content-gallery....
0
votes
0answers
745 views

Loop the posts between two dates selected using jquery datepicker

I went through this link where we can restrict the loop to display the posts only between two dates and it works fine. But if I have a Jquery Datepicker with from and to date, then how can I pass ...
0
votes
0answers
19 views

Combined filters

I have a problem and i'm really stuck on this one. I have a small 'woodshop' and i want people to filter the results. The case: When i check multiple brands, the types should be updated. But when i ...
5
votes
0answers
36 views

Adding a drag and drop re-ordering from a custom post type default list

I have custom post type named 'slider_to_be_ordered' and has the following arguments enabled: 'supports' => array( 'title', 'page-attributes' ), 'hierarchical' => true, ...
1
vote
0answers
22 views

Wordpress form. Variables to display on other page? [closed]

I'm using Ninja Forms, and I'm working on a form where when the users presses "ok" then the page is supposed to go to another page which shows specific information and links for that user. Right now ...
-1
votes
1answer
40 views

Using a filter in functions.php to add content to single posts regardless if post is in main or child category

Im using following filter (codex) to add some html content with a lower priority (20) to the bottom of my single posts wich are in a specified category: add_filter( 'the_content', '...
0
votes
0answers
32 views

how to apply filter to url of wordpress embed shortcode

I use wp embed shortcode to embed videos from my server into my posts. For some reasons i changed my server address and now i want to apply the following function to url of wp embed shortcode. Please ...
1
vote
0answers
31 views

Posts and Attachments with “Published” status in Search

I would like the search to show only published posts and attachments (the attachments are photographs taken directly from the media library). The trouble is, when I specify that the post_status must ...
0
votes
1answer
80 views

How to change Woocommerce breadcrumbs content?

I want to customize the breadcrumbs directly from PHP. Some of the pages are generated dynamically and do not exist in the database, therefore i must automatically put them in the breadcrumbs with ...
0
votes
1answer
32 views

How to append custom text to the output of 'categories widget'?

How do I customize the "categories widget" to append additional text on the sidebar display? from category 1 category 2 category 3 category 4 to category 1 folder category 2 folder category 3 ...