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

learn more… | top users | synonyms (5)

1
vote
1answer
30 views

how to disable default menu classes

i want to disable default menu class, bellow code is disable menu class completely. add_theme_support( 'menus' ); add_filter('nav_menu_css_class', 'my_css_attributes_filter', 10, 1); add_filter('...
0
votes
1answer
26 views

Hide a specific post from Archive Feed

I want to remove a custom post type post from it's archive feed only. But keep in the main feed. Like is I have 1) main feed: myexample/feed 2) Custom post type Archive Feed: myexample/...
0
votes
0answers
22 views

Filtering title in BuddyPress

I'm working on filtering titles for BuddyPress pages (specifically, Groups and Group Forums). I'm having some trouble so maybe someone can point me in the right direction Since 4.1, WordPress has ...
0
votes
2answers
60 views

Filter and validate user role in registration

I want to show a select box for user roles in the registration form. I am using this model: /* ROLES IN LIST REGISTRATION */ // 1. Add a new form element... add_action( 'register_form', '...
1
vote
1answer
29 views

Add Sortable Column For All Post Types

I am creating a hit counter that counts the number of page views across all post types. I have gotten it to work and the column displays for each post type showing the total number of page views. I ...
0
votes
1answer
31 views

Highlight a Post on archive page if it has a new comment?

I have been searching for a solution to highlight a post if it has a new comment but there is no plugin/forum answer about this. Basically I have a custom post type listings on a page. I want to add ...
0
votes
0answers
20 views

Adding Taxonomies Dynamically and Removing Unwanted One

My overall goal is to create taxonomies dynamically in the admin, then use those to filter results on the frontend. I have an options page setup with ACF with a repeater inside that I use to create ...
0
votes
1answer
52 views

How to attach post ID to image links in Wordpress tinymce editor

I'm trying to output the post ID in the rel-attribute of the image links that are generated by WordPress when using the Add Media button. I found a way to retrieve the post id and also how to ...
1
vote
1answer
58 views

How to add #navbar to all page links?

I have several Wordpress websites with large images at their tops, using 2013 child theme. How to add #navbar anchor to all page links, so that the browser scrolls down a bit, when a user clicks a ...
0
votes
1answer
17 views

Use has_filter on comment_post

I hook to comment form (on comment_form_logged_in_after if user is logged in and comment_form_before_fields if not) to add 2 fields (rating and title). These fields can be mandatory or comment will ...
0
votes
1answer
206 views

Creating dynamic filtering on custom post type

My overall goal is to have a custom post type and on the archive page have several different filters in the sidebar, like on a lot of ecom sites. I think this would normally be done in Wordpress ...
0
votes
1answer
44 views

Search and Replace Script Loader in Head Only Works in Footer

I've got a function that uses script_loader_tag filter to search and replace adding asynch="asynch" attribute. It works. I don't want this doing anything in the footer, but rather the header alone. ...
0
votes
0answers
68 views

image_send_to_editor filter

I'm trying to achieve the code below, when using the normal default editor in wordpress. <div class="col-md-6"> <figure> <img class="alignright" src="/wp-content/themes/tna-...
2
votes
1answer
2k views

How can I display parent and child taxonomies in separate drop downs?

The requirement is where i have a taxonomy State which is the parent and it has a child sub-taxonomies they are the Cities, Need to display the state as a drop down, when i select the particular state ...
7
votes
3answers
260 views

How to add headers to outgoing email?

I want to add an additional header to outgoing emails on my sites, so I can easily determine which site sent a given email. (I put a standard functionality plugin on all of my sites, so this is easy ...
1
vote
1answer
45 views

Wordpress php filter admin_body_class not working

I have the following function in a plugin I have built: static function filter_add_body_classes( $body_classes ) { $new_classes = array(); // Only when logged in if ( ! ...
0
votes
0answers
104 views

add attachment-filters on custom modal-media insert

how can I do to have the attachment-filters menu in my upload window? my upload wordpress deafult upload console.log("enqueque on metabox.php - media3.js"); openMedia = { data: false, v: ...
0
votes
0answers
39 views

A way to increase image hard crop quality?

WordPress hard crops images when uploaded. I placed this code snippet in functions.php to make sure there is no image compression/quality loss on image upload and it worked great: add_filter( '...
2
votes
3answers
5k views

How do I add the featured image to the_content after the first paragraph?

My problem: I'm trying to create a filter that will add the featured image of a post to the_content, so that I can have the first paragraph of the_content displayed before this image. What I basicly ...
0
votes
0answers
41 views

Filter a plugin class method

I'm using plugin and am trying to hook into one of it's filters although am having difficulty. The following method: /** /* wp-content/plugins/theme-my-login/includes/class-theme-my-login-template....
0
votes
0answers
32 views

WP_Query order by number of likes

I'm trying to configure WP_Query to order by number of likes. I have a custom table called 'likes', which records which liker (user ID) likes which post: id | liker | post_id 1 | 11 | 120 2 ...
0
votes
1answer
49 views

Post filter Month dropdown at front-end like wordpress backend

when i run the following code. $args = array( 'type' => 'monthly', 'limit' => '', 'format' => 'option', 'before' => '', 'after' =...
0
votes
2answers
154 views

Filter posts by author and category simultaneously

I'd like to include in my website a feature for users to only see posts from a certain author and a certain category. I'm able to do it separately but I can't seem to understand how to do it ...
0
votes
1answer
50 views

Show different pages on site depending on user choice

I am building now a Wordpress site that has a automatic opened popup on the first page which gives the users the possibility to choose between 2 options (ex if they are private customers or company ...
1
vote
1answer
153 views

Adding a Clone link to product attributes - post_row_actions() filter, or how to override a Class question

I have a request to be able to duplicate a product attribute in WooCommerce. Think: duplicating a product (with already existing functionality), or plugins that allow you to duplicate a post. However,...
0
votes
1answer
28 views

Can I remove or edit an include() from a function with a filter?

I need to edit the output of a plugin and the part I need to change is actually a html file that is brought in using include(name-of-file.html). The function has a filter, but I am just now beginning ...
4
votes
1answer
13k views

Add custom menu item using wp_nav_menu_items filter

I have added a snippet to add a "Profile" link to my website navigation menu. My code: add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link'); function my_nav_menu_profile_link($menu) { ...
0
votes
1answer
53 views

Password protected Page add_filter to change the text doesn't work

I search a solution to change the text on my protected page: This post is password protected. To view it please enter your password below: I've found this filter hook and I included it into my ...
0
votes
1answer
67 views

How to append to title via functions.php for auto-posting plugin [duplicate]

What I've got so far I've finally got the functions.php plugin to append a string to custom post titles of a certain post type with this function: function append_album_review_to_title( $title ) { ...
0
votes
3answers
387 views

How can I return shortcode output to the top of the content?

I have a shortcode called update which is used as follows [update title='' date=''] this is some update, etc. etc. 2 paragraphs or more [/update] This outputs some html that wrap the title, date ...
0
votes
0answers
27 views

WP_Query pulling all content even with readmore

I'm using a plugin called quicksand that is working for the most part. It hasn't been updated in 2 years though so support there isn't an option. I just noticed though that even though I'm putting a ...
3
votes
1answer
44 views

Some nav-menu filters do nothing

So, I've been trying to write a plugin, and I need to use the 'nav_menu_link_attributes' filter. I tried adding the filter, but it didn't respond - at all. That is, I made it die mid-process once the ...
1
vote
2answers
48 views

Passing variable from child theme to parent theme

I want to pass my google map custom colors from my child theme to my parent theme. So in my Parent Theme's functions.php I have add_filter( 'post_thumbnail_html', "map_thumbnail" ); function ...
1
vote
1answer
56 views

how to remove dash (-) post status from post title on posts listing page wordpress

I want to remove post status from post title. E.g Currently on listing page post title comes like "Hello World - Draft" or "ABC - Completed" I don't want - Draft or any other post status. Note* : I ...
0
votes
2answers
61 views

Passing variable from child theme function to parent theme filter

I want to pass a variable from my child theme function to a filter which resides in my parent theme. Please let me know whether below code will work or not ? Is it the right way ? Code in Parent ...
0
votes
1answer
32 views

Hook in parent theme Menu function

Trying to modify Parent Menus function on child theme, the original function is: function original_theme_menus() { $menus = array( 'top' => __( 'Top Menu', 'theme-domain' ), ...
0
votes
2answers
50 views

Change post title if post has specific category

Basically what I am trying to achieve is to have title changed of posts which are in category number 30. My code is: function adddd($title) { if(has_category('30',$post->ID)){ $title = 'Prefix '....
2
votes
3answers
1k views

Remove WPML's home_url filter

The WPML plugin filter's home_url in order to provide a link to the home page specific to the language you are viewing. (So if you are reading a Spanish page home_url() will point you to http://...
5
votes
2answers
64 views

What hook do I use to edit the post statuses option in admin?

I want to restrict pending posts to only certain users in the admin section, so I want to remove it from the post status options when viewing all posts (the bit highlighted in red in the image below): ...
0
votes
1answer
13 views

Access or edit custom generated permalinks with WP_Rewrite

I want to create custom permalinks for my plugin using WP_Rewrite. I found the codex the have great examples and this stack topic also explained a lot to me. Currently I've got the following code ...
0
votes
4answers
134 views

How to prepend to the_title for admin-side plugin's use

When I do this: function append_album_review_to_title( $title ) { global $post; if ( get_post_type( $post->ID ) == 'album_review' && in_the_loop() ){ return 'Album Review: '...
0
votes
1answer
71 views

Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu

The Challenge I have been trying to write a filter that applies (prepends a string) to (a) post titles of a certain post type and (b) to that same post type WordPress admin backend for use by an auto ...
0
votes
1answer
64 views

How to check if “is single” page

I know – at first glance the problem may seem easy to solve – and I hope it is – I just can't figure out where/ how to check if I'm really on a single page, or just rendering a single page in the loop....
0
votes
1answer
38 views

Regex works in regexr, but not if I filter content [closed]

I want to filter the content of everypost and add classes to my links depending on certain conditions. At the moment I just want to filter all href attributes from the content and change them. ...
0
votes
2answers
799 views

Add Class to a div using a filter?

is it possible to add a dynamic class to a div using a filter in the functions.php? I know it's possible for the body-tag - also for a custom defined div with an id? if ( !is_search() ) { $...
0
votes
1answer
15 views

Filter authors on meta value

I have added a section to my user profiles called ArtistCategory. This can be value X or Z. I'm using the code below to get a list, which I use in a menu and show after the artists display_name the ...
4
votes
3answers
252 views

Remove description from <title> on Home

My theme has support for title-tag add_theme_support('title-tag'), but I can't remove the wordpress description bloginfo('description') from <title> on Home page. I'm trying using this filter ...
0
votes
1answer
29 views

Is it possible to completely replace a post with an action/filter?

Currently I am trying to replace the $post global with another dynamically loaded post in the wp action. However, while even in the templates the correct post data shows when outputting $post, the ...
3
votes
4answers
1k views

How to filter users on admin users page by custom meta field?

The Problem WP appears to remove the value of my query variable before it gets used to filter the list of users. My Code This function adds a custom column to my Users table on /wp-admin/users.php: ...
2
votes
2answers
393 views

How can I add an Author filter to the Media Library?

By default the WordPress Media Library allows you to filter results by their type or date. How can I add a third drop down to list and filter by author? Currently we have this: I'd like to have ...