How to return a 404 when custom query matches nothing?

I’m using add_rewrite_rule() to create a new endpoint to my author URL. example.com/author/my-endpoint Here’s my code: // Pagination rule. add_rewrite_rule( '^author/([^/]+)/my-endpoint/([0-9]+)/?$', 'index.php?author_name=$matches[1]&my-endpoint=1&pag=$matches[2]', 'top' ); //

Cheating, are we? Editor role not saving settings page for custom post type

I currently have a custom post type with a sub menu page (add_submenu_page). On this page I have a form with some basic settings such

Short code into PHP

I am a newbie so apologize if it’s not an easy question to figure out. I need to add a read more button into a

Change database image location for transportability

The problem: the worpress site is developed locally by my team. When we finish, we will put it online. Now, changing the siteurl, home and

woocommerce – switch account from URL

I am trying to figure out how to allow people to switch subscription variations using an add to cart method. Currently, people sign up using

PHPMailer SMTP Could not connect to SMTP host error — timezone issue?

We use WordPress and PHPMailer for sending email via SMTP. A few weeks ago, our email stopped working and this was brought to my attention

Ajax call does not activate callback function

I’m struggling with this for a couple of days already, so any help is most welcome. Not my first time setting up Ajax with WP,

wp_redirect() creating an endless loop

As I have searched for the answer to this question, I have found quite a few answers that have worked for other folks. However, none

How do I center a contact form 7 in wordpress

I am working for a client and can’t figure out how to center a contact form in WordPress. Any help would be greatly appreciated. -Josh

Display hidden div after successful form upload

I’m using a shortcode as part of my membership setup which allows users to upload files directly to their contact record in my CRM. This

Filter for adding image to RSS feed not working

the code at the end of my functions.phpfile in my theme seems to have stopped adding images to my RSS feed. Does anyone know what

wordpress ajax does not activate callback function

I’m struggling mightily with this for a couple of days already, so any help is most welcome. Not my first time setting up Ajax with

dropdown menu when clicked links to sections of the original page that is not static home

using wordpress with a menu navigation and home as the frontpage, i want to have a scrolling page of content on the firm page that

To get current page data using custom plugin on page load

I have created a custom plugin to get data of page. I tried some page load hooks but its not working. Basically there is one

WordPress change uploads directory to shared network folder UNC

Is there a way to change the upload default folder to a folder on the network? I have WordPress running on Machine1 and a shared

Woocommerce admin Product Data Field Positions

I have added the SKU field to my General Tab under Product Data in the Admin panel – see image 1. Existing Layout I want

Back to Top 145132 wordpress questions, 32 Wordpress answers.
Wordpress related, All rights reserved
Powered by Creative Advertising Powered by Vectorial Graphics