Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73

*Without quotes PHP interprets the REQUEST_URI as a constant** but corrects your typo error if there is no such constant and interprets it as string. When error_reporting includes E_NOTICE, you would probably get an error such as: Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in <file path> on line <line number> But if … Read more

Disable every rss feed except home feed

// remove_author_feed_link( $link, $feed ); // As we do not pass $link and $feed is empty by default, function just exits function remove_author_feed_link() { return; } add_filter( ‘author_feed_link’, ‘remove_author_feed_link’ ); function remove_category_feed_link() { return; } add_filter( ‘category_feed_link’, ‘remove_category_feed_link’); function remove_search_feed_link() { return; } add_filter( ‘search_feed_link’, ‘remove_search_feed_link’ ); function remove_tag_feed_link() { return; } add_filter( ‘tag_feed_link’, ‘remove_tag_feed_link’ … Read more

Adding php within a return statement [closed]

You can just call PHP functions directly. In this case however we possibly don’t want to call the_permalink() since it echoes out the link: function the_permalink( $post = 0 ) { /* … */ echo esc_url( apply_filters( ‘the_permalink’, get_permalink( $post ), $post ) ); } whereas we want to return the link in a string. … Read more

clickable title of 2 post on mainpage USING functions.php

here is answer 🙂 add_action(‘generate_after_header’, ‘work_only_on_front_page’, 999); function work_only_on_front_page(){ if ( is_front_page() ) { echo ‘ any text with divs’; $args = array( ‘posts_per_page’ => 2, // we need only the latest post, so get that post only ‘cat’ => ‘1’ // Use the category id, can also replace with category_name which uses category slug … Read more