Wordpress Permalink Issue Remove Auto Added Code - php

I have a Website of Wordpress In My Website When I click on any URL After complete Loading Content Page Some Codes Automatically Add on Permalink
For Example
http://example.com/wow-amazing/ Correct Link This Link Is Fine
After Complete Page Loading
http://example.com/wow-amazing/#.WfB5iI-Czcs
How Can I Remove #.WfB5iI-Czcs this Automatically Added Code From Permalink
Thanks In Advance

That part with # is generated at front side, so it actually doesn't affect you permalink. So there is no problem if you see that.
And actually it doesn't come from permalink, it is generated by some plugin's javascript. (for example AddThis generates such anchors, if you use AddThis, then the reason is AddThis)

Related

Wordpress: changing only one page url from database

In Wordpress I created a page "home" (https://sitedomain.com/home) but I cannot render it equal as the homepage (I made a page template equal to index.php and implemented the custom query but still not working properly).
I currently have a
echo("<script> window.location.replace('https://sitedomain.com')</script>"); statement in the single page template file allowing me to redirect users to the actual homepage but it is slow. I want to manually change the URL of this page in the database but I cannot find it in the Database.
Also, it is not possible to modify the URL from the dashboard since the minimum url must be https://sitedomain.com/home.
Is it possible? Where to find the single URL of the page in the Database?
You can just define that page as your homepage in the WP dashboard: "Settings > Read > select static page as starting page" (or similar, not sure about the exact English terms)
in the end I simply used JQuery to replace the href attribute with the one that I needed (https://sitedomain.com).
Not ideal solution but it works.

How do I prevent a dynamic link change in PHP?

I develop in ASP.NET MVC so please forgive my lack of the basics when it comes to PHP and WordPress. We have a WordPress site where the terms and conditions link in the footer is broke on one page but works on another.
On our home page (http://www.ourdomain.com) there is a link and when I hover on it I can see in Chrome that it dynamically changes from:
ourdomain.com/wp-content/themes/mm/pdf/Terms.pdf
to:
www.ourdomain.com/wp-content/themes/mm/pdf/Terms.pdf
When I view the source of the page the anchor tag is like this:
Terms
This works fine and renders the necessary pdf file. We have another url (http://www.ourdomain.com/contact) that also has a terms and conditions link that changes from:
ourdomain.com/contact/wp-content/themes/mm/pdf/Terms.pdf
to:
www.ourdomain.com/contact/wp-content/themes/mm/pdf/Terms.pdf
When I view the source of the page the anchor tag is as follows:
Terms
I have access to the entire site and the MySQL database for the site. What can I change to prevent the link from adding content to the URL? Are such links usually stored in the database?
Its because you didn't enter full path so the address is countine from your page address. as you see happend with the contact
/ will point to domain base
./ or empty will point to current url
Examples example.com/contact
<a href="/somefolder/file.pdf">
will point to http://example.com/somefolder/file.pdf
<a href="./somefolder/file.pdf">
will point to http://example.com/contact/somefolder/file.pdf
To avoid this you can enter the full url.
In case of wordpress if the link is in your theme you can use the function get_stylesheet_directory_uri() to get the full url for your theme.
Terms

Wordpress: How to build a link with php-function call?

I want to add a logout link to my wordpress page.
Logout
The link is visible on the page but when i click it it redirects me to
https://www.mywebsite.de/%3C?php%20echo%20wp_logout_url(%27https://www.mywebsite.de/%27)%20?%3E
which of course result in a 404. Obviously the php code is not executed. What am i doing wrong? How can i build the link dynamically?
EDIT:
I want to place this link via wordpress dashboard to the navigation menu (Appearance -> Menus -> Costum Links). For a first try i just added the link to my front page (Pages -> All Pages -> Choose Front Page --> added link in editor to page content).
In booth cases the php code is not executed but added to the link which results of course in a broken link (404).
The control characters like "<" get substituded. The whitespaces too. Maybe it is a character encoding problem?
Logout
https://developer.wordpress.org/reference/functions/wp_logout_url/
The problem was that is not possible to execute php code in wordpress editor (which is a good thing due to security reasons).
So i found another way: I created a shortcode for generating my dynamic link/url. With the plugin 'Shortcodes in Menus' everything works just fine.

Anchor tag not working in Wordpress

The first thing is that the code is written in HTML and now I am changing this code in Wordpress. I have a home page where I have created a top menu which has links to several other pages.
This is the code I used to link it:
facilities
This was working fine when I was doing in in HTML, but it's not working when I am opening my page in localhost. When I click it, it shows a message that no content is found.
You need to add base url at first. For wordpress, you can do this with get_template_directory_uri().'/facilities.php'
Here, i assumed 'facilities.php' is located on your base directory if there is more directory you need to add those too. Hope, it helps.

Internal link in WordPress footer.php file not working

I am creating a child theme and I have added a link in the footer.php file to a page within my website. I used the WordPress recommended:
PAGE TITLE
which displays the proper URL when the link is clicked, but I get a 404 error. I determined that if I set my permalink setting to Default it will bring up the page, but the URL is the permalink ID, not the slug. I want to use Post name for my permalinks for SEO purposes. Any suggestions?
With out seeing what the resulting URL is it's hard to say what the problem is. I'm guessing you're using the example here on the get_permalink() function page. My guess is that you simply don't need to use the esc_url() function. According to Stephen Harris get_permalink() performs it's own sanitation so using esc_url() on it is not necessary despite it being "recommended" on the codex.
It would be more helpful if you posted a link to your page or at least the resulting code.

Categories