All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

How to get post image root URL?

By using below code, I got Image url like "http://localhost..." but I need root path of that image from "var/www/html/.... " $FeaturedImage = wp_get_attachment_image_src( get_post_thumbnail_id( $...
0
votes
1answer
59 views

Remove POST_TYPE from custom post type permalink

I have a post type named services with the following permalink DOMAIN/services/investing/ (Single Page Permalink). I want the permalink to be changed like DOMAIN/investing/. I don't want the ...
0
votes
3answers
74 views

Get the current post/page URL with plain permalinks

I got it to work with this: $url = home_url( add_query_arg( array(), $wp->request ) ); However, if the permalink is plain, all I'm getting is the homepage url (instead of the post url). So what'...
1
vote
1answer
61 views

Custom url structure for custom template

I have a custom taxonomy called activities and a custom role called operator. So, if example.com/operators/bird-watching is visited then I want to list all the operators that offers bird-watching. ...
1
vote
3answers
126 views

How to use $_GET function Wordpress backend

I use Plugin Boilerplate for my project. I searched the internet and read all the questions but I couldn’t find what I need. I also read the WordPress Codex. I think I couldn’t get the idea. I have ...
1
vote
1answer
68 views

Modifying Author Link to add Author Meta in URL

I have a plugin which adds a custom role called the trip_vendor. I am trying to edit or modify the profile url of this role. Currently, it is example.com/operator/username but I want to change it to ...
0
votes
0answers
45 views

Adding body class in author page for custom role

I am trying to add a unique body class using body_class filter if the role is a custom one via my plugin. I have a custom role called trip_vendor and the url for its profile page is abc.com/operator/...
0
votes
1answer
45 views

Changing author slug for a custom role without using plugin

I am trying to change author slug for a custom role. A role called trip_vendor is added by my plugin but I want to change the author slug only for this role. I have a function but this changes author ...
0
votes
1answer
34 views

Author Meta in Author URL Link

I am trying to modify the default author link url structure. In the URL, I would also like to change the string author to operator add some author meta along with the username. So far, I have ...
0
votes
2answers
85 views

Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post

I am building a custom post type and its respective custom taxonomy. Here is the code: add_action( 'init', 'register_my_types' ); function register_my_types() { register_post_type( 'help', ...
0
votes
0answers
17 views

Custom author page for custom role

I have created my own author page (author.php) where all the posts from that author is listed. The link to that page is - localhost/abc/author/new-user/. This is working fine in localhost. But the ...
0
votes
0answers
12 views

Custom role not listed

I have a custom role called my_vendor which submits custom post called tour from the front-end. The issue is that the function wp_list_authors() is not listing the users having my_vendor role. However,...
1
vote
1answer
71 views

Auto save permalink setting page with the plugin activation

To add my personal content into my own endpoint of woocommerce my account page, I need to click on save in permalink setting page.But I would like to avoid this by auto reload this settings.
1
vote
1answer
6k views

WordPress plugin how to run function when button is clicked

I am writing a WP plugin. I have created a button for the user to click in thw WP dashboard. I need to run a function when a user clicks the button, shown with a red arrow. The code snippet for the ...
1
vote
0answers
84 views

Problem with dinamic add_rewrite_rule()

today i am trying to make a plugin for wordpress that allow change the url of a post to whatever you want, i am added a new custom field called post_permalink_replace in that custom field the user ...
0
votes
0answers
83 views

% encoded URL giving 404 error in Wordpress

I am developing filters for custom post type. Filter form is targeted to same archive page. The problem I'm facing is if I pass particular parameter in GET then it's showing me the results if sent ...
1
vote
0answers
23 views

Custom Permalink to remove category word , keeping posts permalink with date?

I have my post links like this: //abc.com/2018/09/abc-dhs-djs.com/ and for category like this: //abc.com/category/mycat/ and finally for tags its like: //abc.com/tag/mytag/ I want to remove ...
0
votes
2answers
42 views

Is it possible to change plugin's Admin Panel Url?

I'm curious to know can I change the admin panel URL from mydomain.com/wp-admin/?page=my-plugin to mydomain.com/wp-admin/my-plugin.php Thanks!
1
vote
2answers
55 views

Customize permalink when creating a post

I have a custom post type named houses. Inside my custom post type I have several custom fields which I created using ACF. What I need to do is to change the permalink when I create a new post. I ...
2
votes
2answers
2k views

Remove Slug from Custom Post Type results in 404

I am working on a plugin that creates lists. After creating a list, I wanted to remove the slug from the url Post type: $rewrite = [ 'slug' => 'single-link', 'with_front' =&...
0
votes
1answer
64 views

Add Post and Comments menu no longer visible

For many years I have used to following technique to add a /news prefix to my posts URL. I have the following code in the functions.php of a custom plugin: function my_change_post_object() { global ...
0
votes
1answer
28 views

How to create new content type and flushes rewrite rules without visiting the permalinks page?

I could not found a realiable way to create new content type and allow the permalink structure works. Every place where someone wants to let the permalink structure works to a new content type in ...
0
votes
2answers
9k views

Passing URL parameters to WordPress pages and pretty url

I create shortcode like this function test_func( $atts ) { return $_GET['myvar']; } add_shortcode( 'test', 'test_func' ); and one page with this name myparameters so this is the final url ...
1
vote
1answer
2k views

Remove custom post type slug from URL and add taxonomy Slug

I am having an issue while changing a custom post type URL. Current post type URL is: http://example.com/product/product-slug where product is a custom post type. I want to change it to: http://...
2
votes
1answer
548 views

Add a Custom Permalink option in the Permalink Admin Screen?

My plugin has several custom post types and the main one I want to make its permalink slug changeable. I would prefer to keep things clean and add that option in WordPress' Permalink admin screen, ...
0
votes
1answer
93 views

Coming soon pages with rest of site in maintenance mode

I already created a custom plugin but am officially stuck! I need to create coming soon page that: Includes option to sign up for newsletter Link to privacy section Thank you page after signing up ...
0
votes
1answer
50 views

Get (eventual) permalink from post within Edit Post in Admin panel

I'm working on a plugin that needs to access grab the Permalink from within the Edit Post screen to send it to a link-shortener API. The catch is that I will need to grab the permalink before the post ...
0
votes
0answers
98 views

Fixing the WP Post Object for Custom Route

I'm currently in the process of building a custom plugin for a client that involves displaying front end user profiles for any "subscribers". These profiles will be populated with various user meta as ...
0
votes
0answers
575 views

Can I override the permalink/slug on creation

I have a plugin that imports data from an external API, creates a 'Product' Custom Post type ( or updates an existing one ) and then adds all the meta data. Every time we update the product from the ...
9
votes
2answers
654 views

Best way to flush_rewrite_rules for custom post type, in a mu-plugins plugin?

I am writing a plugin that instantiates a custom post type (among other things). It is a multisite plugin and lives in the directory mu-plugins. What is the best practice for handling ...
0
votes
1answer
63 views

Wordpress permalink setting

I have a doubt. If book is my custom post type, language is my taxonomy, english is the item in taxonomy , Harrypotter is new post in book with txonomy english. Then how i get the url structure like ...
1
vote
1answer
236 views

How to change custom post type pemalink Hierarcy

When we set permalink as Post name and go to wordpress any default post Like "Testing 123" single page its link looks like this localhost/foo_articles/testing-123 Now i when we change our permalink ...
0
votes
2answers
671 views

Add category slug as class attribute in a link array

This incredible website and the genius developers here have helped me significantly in the course of my WP Dev over the years, firstly THANK YOU. I am now faced with a problem that I have been trying ...
1
vote
0answers
488 views

Perform internal redirect in WordPress?

Let say I have an existing page named "bar", e.g. http://www.example.com/bar I want to write a plugin, which when called, will load the content exactly same as bar (not just post_content, but the ...
0
votes
1answer
44 views

Forward an old url rewrite scheme to a new one?

I have the following url rewrite for custom post type: add_rewrite_rule( 'event/([0-9]+)', 'index.php?post_type=event&p=$matches[1]', 'top' ); Due to a site structure change, I'll be ...
10
votes
6answers
13k views

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

I am having a bit of a strange issue with rewrite rules not flushing properly. I have tried using flush_rewrite_rules(); and flush_rewrite_rules(true);. I have also tried globalizing $wp_rewrite ...
1
vote
1answer
1k views

Why doesn't flush_rewrite_rules run on plugin activation?

I'm trying to flush rewrite rules in a plugin and it isn't working. I have to go to permalinks -> save in the admin panel for the rewrites to flush. Can anyone see why? class SpektrixPlugin { public ...
1
vote
1answer
344 views

Publish Post After Click On A Link

I have a frontend posting form (CF7), where user inputs (among other data of course) his email. Now I set the status to pending. What I want is, that the user would get trough autoresponder a mail, ...
2
votes
2answers
421 views

URL rewriting must be activated manually for my plugin

I am creating a Wordpress plugin which create pages (with get_header(), get_footer() and get_sidebar()) for searching through an API. Of course, I have defined some rules for URL rewriting like this: ...
0
votes
2answers
103 views

How to embed a new string in url?

I am creating a custom tours and travel theme in which I have created custom post type Cities, Locations, Destinations and i am using custom permalink structure. /%category%/%postname%/ So now I want ...
0
votes
3answers
853 views

Custom rewrite rules for /pastissues/%category%-%postname%.html

I have been researching this for over a week now. I've tried a few tutorials on custom rewrite rules and custom post types, but I'm still not sure which direction I should go in for making this ...
0
votes
2answers
98 views

How to get the permanent link in a plugin?

I'm writing a plugin to add some extra contents that contain the permanent link to the (single) post. function abcd_add_contents($content) { $extra_content = the_permalink(); if (is_single()...
7
votes
3answers
26k views

How to call a plugin function from index.php

I have created a function in my plugin myplugin with the name foo, how to call it from the frontend? e.g. index.php?
0
votes
2answers
948 views

Make get_permalink() work outside the Loop using filters

I am developing a plugin which displays a wordpress post in a lightbox outside the loop. I noticed that some plugin which modify the contents of the post (like Facebook Like button plugin) use the ...
4
votes
0answers
177 views

permalinks with get variables

I'm trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows add_filter( 'query_vars','driver_vars' ); function driver_vars( $vars ) { ...
0
votes
1answer
61 views

Get URL of Post You Are Editing

I can't seem to find this anywhere, Is there a way to retrieve the URL of the post (which is of a custom post type) you are editing. Basically I want to somehow get the same URL that shows up like ...
2
votes
2answers
1k views

How to get the permalink of a page when loading my plugin

I'm implementing a web widget and for this reason I'd like my script to respond to the request as soon as possible, to avoid loading unnecessary thing. I've found out that calling get_permalink( $...
0
votes
1answer
112 views

Changing permalink structure breaks link to .php file which generates files dynamically

I'm creating a (calendar) plugin where one feature is the ability to download an event as a .ics-file. To do that I have a file called ics.php in which I generate an .ics-file based on the id of the ...
1
vote
1answer
164 views

add_rewrite_rule behaving strangely

I'm customizing another plugin by changing the rewrite rule, from: add_rewrite_rule('^api/auth/([0-9]+)?/?','index.php?__api=1&uid=$matches[1]','top'); to: add_rewrite_rule('^api/auth/'...
0
votes
1answer
357 views

How to use permalink query to go to specific tabs in posts

I'm not really sure how to phrase the questions, but hope it's not too confusing. Basically I've create a plugin which inject custom tabs into the posts content when displaying. For now, just assume ...