wordpress - PHP - remove last part from URL -


Good day to everyone!

I grab the URL of the article and the last part (one level runs up).

WordPress function and ID); ? & Gt;

Usage example URL of my current article:

  http://example.com/apples/dogs/coffee  

Remove the last part of the URL so that it will be:

  http://example.com/apples/dogs  

(and end With no slash in it)

Then it will return the current Wordpress URL:

  & lt; A href = "& lt ;? php echo get_ paramultink ($ post-> ID) ;;>" & Gt; Text & lt; / A & gt;  

But how can I remove the last part of it?

Thanks in advance!

  $ url = 'http://example.com/apples/dogs/coffee' ; $ Newurl = dirname ($ url);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -