How do i get (unique) page name?

The WP global variable $pagename should be available for you, I have just tried with the same setup you specified. $pagename is defined in the file wp-includes/theme.php, inside the function get_page_template(), which is of course called before your page theme files are parsed, so it is available at any point inside your templates for pages. … Read more

Dashboard Widget Form

That if(‘POST’…) just alone -in the middle of the plugin code- doesn’t seem right. You can hook into load-$pagenow and process the form submission there: add_action( ‘load-index.php’, ‘check_posted_data’ ); function check_posted_data() { if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘my_prefix_message’] ) ) { wp_die( “I’m here! {$_POST[‘my_prefix_message’]}” ); } } Please note that you’re missing security … Read more

Escape special characters in image link

Because based on your description, I am not sure what is your purpose doing the escape. If you want to escape the URL, you might consider using WordPress internal esc_url() function If you want to do some more low level control with PHP native function, you may consider urlencode() and you might have to manually … Read more

Warning: array_pop() expects parameter 1 to be array, boolean given

get_the_terms() will return a boolean false under some circumstances: A post with no terms assigned gives a false result, not an empty array. https://codex.wordpress.org/Function_Reference/get_the_terms#Returns It sounds like that is what is happening. You need to check that $post_link = to ensure that it is the type you expect before trying to use it.

allow user to select pages from dropdown in my plugin

Change your code to this register_setting( ‘rex_plug_options’, ‘rex_plug_options’, ‘rex_plug_settings_validate’ ); add_settings_field(‘rex_plugbox_text_exit_pop_selected_pages’, ‘Select Pages’, ‘rex_plugbox_text_exit_pop_selected_pages’, ‘rex_plug_box’, ‘rex_plug_main_box’); //with selectbox you cannot select multiple pages. If you need that try checkbox function rex_plugbox_text_exit_pop_selected_pages(){ global $rex_plug_options; if(!isset($rex_plug_options[“rex_plugbox_text_exit_pop_selected_pages”])) { $rex_plug_options[“rex_plugbox_text_exit_pop_selected_pages”] = “”; } ?> <select id=”rex_plugbox_text_exit_pop_selected_pages” name=”rex_plug_options[rex_plugbox_text_exit_pop_selected_pages]”> <?php if( $pages = get_pages() ){ foreach( $pages as $page ){ echo … Read more

Include Class File in WordPress

Please clarify where you initiate the object $user in both ways (function.php and header.php). This is another thread on stack with similar kind of issue, have a look: Organizing Code in your WordPress Theme’s functions.php File? Thanks, Vee