All Questions
35,323
questions with no upvoted or accepted answers
4
votes
0
answers
486
views
What to use: wp_is_post_autosave( $post_id ) or DOING_AUTOSAVE?
I was doing some action on save_post hook, and noticed that there exists
wp_is_post_autosave( $post_id )
function.
How does it differ from DOING_AUTOSAVE constant?
If I want my action not to run ...
4
votes
0
answers
427
views
extend Meta Box / Document Panel
For a project, I'm trying to figure out the best way to implement a checkbox, related to a post type.
What I'm trying to to:
On the final website, there should be a dropdown-button, with upcoming ...
4
votes
0
answers
5k
views
How to get_terms() only of terms matching an ACF meta value?
My custom taxonomy "company" has an Advanced Custom Fields field group with fields including a Checkbox, "tags". (This adds to each "company" term fields including "tags", which accepts multiple ...
4
votes
0
answers
425
views
How to add button to post page WordPress 5.x
How can I add a button to a posts page? what hook can be used to add a custom button
I'd like to place it next to, or near, the "Publish/update" button, or modify the publish button for triggering ...
4
votes
1
answer
2k
views
WordPress “Link has expired” error on updating posts
I'm maintaining a WordPress site on GoDaddy for a client and they started to get the "this link has expired error" when they saved a post. It does not happen when I upload a file. However, I am ...
4
votes
1
answer
2k
views
Strange characters on wordpress site - Not UTF8 Issue
I've imported WordPress post data onto a new site and noticed I have strange characters showing on pages and Blog posts.
It usually shows where apostrophes should be.
I've searched multiple ...
4
votes
0
answers
3k
views
Gravity Forms: Create fields programmatically
Is there any possiblity to create and manage gravity fields dynamically?
I have form with ID 4 with couple fields. I want to add some fields of type checkbox with my own custom external data which can ...
4
votes
0
answers
920
views
What could cause WP-CLI search-replace to not replace all instances of a string?
We're migrating a site from dev to production using wp-cli to replace all occurrences in the database for the url, just like in the search-replace example. (http://example.dev to https://example.com)
...
4
votes
0
answers
471
views
Best way of removing emoji support from url / slug only
Couldn't find anything on the topic.
I guess something could be done with the 'wp_unique_post_slug' filter but how would I go about just removing the emojis from the slug?
I've tried all kinds of ...
4
votes
1
answer
5k
views
AJAX handler throws 400 (Bad request) - why?
I am trying to apply a "Load more posts" function to a post loop, but I am dealing with a 400 Bad request, when admin-ajax.php is referred to.
The reference I used is this - https://rudrastyh.com/...
4
votes
1
answer
2k
views
Exclude custom taxonomy from search results and archive pages
UPDATE:
I have the following code working. It excludes the taxonomy from the search results. However, I would like this only to happen if a user is not logged in. The code below is taking effect for ...
4
votes
1
answer
994
views
get_post_meta returning empty string when data shows in the database
I'm absolutely stumped and I'm hoping this is something stupid that I just can't see because I'm too close to it.
Working on an LMS using Sensei. Trying to get the course_id from a lesson. Pretty ...
4
votes
1
answer
2k
views
WP_Query min and max values
I'm building a houses class and I want to filter these houses with a query. But don't get any results:
Example house:
Min price: 10
Max price (field not required): empty
I've a price filter ...
4
votes
1
answer
332
views
get_theme_mod doesn't return the theme customizer preview's new values in after_setup_theme hook
If I print the value of get_theme_mod( 'enable_sleek_header', false ) it is always the previously saved value. If I print the same thing in the header of the theme, it returns the value from ...
4
votes
1
answer
89
views
Importing users from one database to another and saving passwords
I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordPress database while saving the old WordPress site passwords on the new WordPress ...
4
votes
1
answer
62
views
How do I get the total number of categories in a list of search results?
I want to display the total count of categories in a set of search results.
For example, "10 posts found in 3 categories." (Assuming that each post has only 1 category.)
Right now, my solution is to ...
4
votes
1
answer
100
views
How does WordPress work out the srcsets?
WordPress gives some images srcset but not others how does it work this out, I cannot find anything documenting the topic. How does WordPress decide which images to give the srcset attributes to.
4
votes
1
answer
6k
views
Multisite Subdomains result in 403 Forbidden
So I have setup multisite as per the WordPress website page: https://codex.wordpress.org/Create_A_Network
I'm using the latest WordPress 4.8.
Setup
example.com
sub.example.com
All requests for ...
4
votes
1
answer
2k
views
Creating a post with the REST API, curl and oauth returning 401 error
I'm trying to create a WordPress post using the REST API, OAuth, and cURL. However, I'm running into some trouble.
I'm able to create a blank post (no title, slug, etc) using the following code:
$...
4
votes
0
answers
210
views
Can rewrites fallback if 404? Rewrite conflict issue
I have pages and product categories on my site:
Pages:
--About
--Contact
Products:
--Category 1
----Subcategory 1
--Category 2
Ideally I want mysite.com/category-1/subcategory-1 to show the product ...
4
votes
0
answers
409
views
HTML5 theme support for comments + form 'novalidate' - how to handle it properly?
INTRODUCTION
My research is based on following assumptions:
WordPress version supports HTML5
Go to any admin page and inspect the resulting document. It should start with <!DOCTYPE html>.
...
4
votes
1
answer
366
views
Is there any way to test if a function running only on plugin update is successfully running?
Is there any way to test if a function running only on plugin update is successfully running? Right now I am calling function if WP version present in configuration file is not same as plugin version'...
4
votes
0
answers
401
views
display most popular tags of category?
0ne year ago i used this code to show most popular tag of the current category in my sidebar:
function my_tags_from_category( $atts, $content = null ) {
extract(shortcode_atts(array(
'type' => ...
4
votes
1
answer
2k
views
Order post by year DESC and month ASC
I have a worpresss 4.0.12 website; i created a custom template category-$id.php in which I have to show post ordering them by Year DESC and by month ASC (or a custom field ASC), the result should be ...
4
votes
3
answers
1k
views
Wordpress generating 404 on .mp4 file in theme folder
I am trying to load a full width video on my homepage. My situation is almost exactly like:
Video Background - (php & css) - generating 404 error on page load - Wordpress Theme File Structure ...
4
votes
1
answer
5k
views
Redirect to login when on private page, and when logged in to specific page
I´m using a plugin called "private content login redirect".
The plugin is actually only containing this piece of code:
add_action('template_redirect', 'private_content_redirect_to_login', 9);
...
4
votes
2
answers
2k
views
generate custom permalink based on a custom field
I'm newbie to the Wordpress.
So far I have a custom post type called 'property'. This post type has one custom field called 'property_city'.
In WP-admin - permalink setting, I have selected Post ...
4
votes
2
answers
2k
views
Do not allow users to create new posts and pages
I'm defining a new user role called Proofreader and as the name says, users of this group should be able to read and also edit the posts and pages. But I do not want them to create new ones.
With my ...
4
votes
4
answers
21k
views
alt, title tags not showing
I have added alt tags, title and description on all the images on my website but none are showing when I check them in the inspect element tool in chrome or firefox.
Here's a screenshot:
And here's ...
4
votes
2
answers
2k
views
Advanced Custom Fields into functions.php
I'm trying to include a few custom fields I've created in my functions.php file so they're native to the theme I'm working on. However they're not showing up on the edit screens of the posts I've set ...
4
votes
0
answers
2k
views
Setting Cookie Using a Variable from the URL
I need to hand code an affiliate link (we do not want to use an existing plugin). I do not do a lot of coding, so bear with me.
It seems so simple I have a link:
http://www.domain.com/?code=8765
...
4
votes
2
answers
732
views
Give attachments an archive page
I'm trying to override WP's default URL structure for attachments where, if they're attached to a post, the URL is /post-slug/attachment-slug/ and if not it's simply /attachment-slug/.
What I'd like ...
4
votes
1
answer
656
views
What permissions should i have set up for the Database User after i have Wordpress set up?
so i was reading this on php.net and read this
Never connect to the database as a superuser or as the database owner. Use always customized users with very limited privileges.
Before getting my ...
4
votes
1
answer
2k
views
Site redirects to wrong url when saving settings
I have a subdomain:
https://blog.example.com/
I forcibly redirects to subdirectory:
https://www.example.com/blog
By changing site URL and some RewriteRule on .htaccess.
Now the website and admin ...
4
votes
4
answers
266
views
What is the Difference between directly call a function and call a function using add_action?
What is the difference between following two codes? (Directly call a function and call a function using add_action)
function pp_submit__link_form(){
if(isset( $_POST['action']) && $...
4
votes
1
answer
671
views
How to use parent theme's enqueue methods
According to the codex, when creating a child theme, you have to manually enqueue the parent theme's scripts.
My parent theme has logic to conditionally display various css files, cached css, and ...
4
votes
0
answers
97
views
Saving WordPress generated thumbnails in a subdirectory
I.e. an uploaded image image.jpg is stored in wp-content/uploads/2016. WordPress will generate thumbnails named image-150x150.jpg, image-300x300.jpg, and image-1024x1024.jpg in the same directory.
Is ...
4
votes
1
answer
1k
views
Give editors access to particular plugin - turn "admin.php" into "edit.php"
I'm using the Business Opening Hours plugin. I made it appear in the sidebar using the Client Dash plugin, but when the Editor clicks it, they cannot access it, only the Admins, how can I change that?
...
4
votes
0
answers
274
views
Retrieve CSS and JS From the REST API
Does anyone know of a way to get a list of all registered styles and js scripts in-use on a site via the REST API? Essentially was wp_print_styles() does?
4
votes
2
answers
618
views
load/require specific php files for specific pages/templates/post types
I have a plugin with multiple php files. I want to load some of them only when specific template files are loaded. I don't want to load everything.
Currently, I'm doing it with
add_action( 'wp', '...
4
votes
1
answer
44
views
Prevent Deletion of Blogs
I'm trying to prevent the deletion of blogs in a WordPress Multisite installation. There is already a plugin that does this, but it uses wp_die() as the solution, which in my scenario does not work.
...
4
votes
0
answers
794
views
Order posts by meta_value even if meta_key is not filled
I want to sort search results by the value of custom field ('name-official') for all posts (is this field filled or not).
But when I add filter in function.php like
function searchExcludePages($query)...
4
votes
1
answer
894
views
Using the REST API (v2) javascript client on a private namespaced route
I am using the latest version of the REST API plugin in a project and I've added my routes to a separate namespace (as recommended in the documentation). The javascript client included with the API ...
4
votes
1
answer
653
views
Custom taxonomy query for a custom post type
I have a custom post type called news with a custom taxonomy called news category. Right now I have a template called taxonomy-news_category-press.php where press is one of the news_categories. The ...
4
votes
0
answers
88
views
my function doesn't return my post from today
I'm using gravity form to create some custom post type - as events.
Everything is working great, There is some date field to setup the event from x to y date. ALl of this working great.
However, I ...
4
votes
1
answer
395
views
publish_post action hook doesn't give post_meta_data
I write the following function to get the post data on publish post but i see that post_meta is not available, its always empty. How do i retrieve the post meta data of a post on publish_post hook?
...
4
votes
1
answer
1k
views
has_term or in_category for Custom Post Types
I have property as a custom post type. I want to display a specific message if the property is in the sold category. To do that, I'm using the function below:
if ( has_term('sold', 'category')) {
?&...
4
votes
0
answers
92
views
Can I strip HTML tags in the "Compare Revisions" screen?
I am building a CMS for content editors that have zero tech savvy. They currently use a system called NewsCred that allows them to compare revisions much like how WordPress does when you visit /wp-...
4
votes
0
answers
662
views
wp-admin remove the subfolder URL
I have a problem with WP. I have a website with this URL: http://sub.domain.com/subfolder My Website works fine, but when I connect on wp-admin, the subfolder URL disappeared (http://sub.domain.com/wp-...
4
votes
1
answer
177
views
Detecting Wordpress Customizer Panel
Recently started developing a Wordpress theme relying heavily on the customizer API.
One thing I'm stuck with is detecting when a specific panel has been clicked or opened.
Regular old "on click" ...