mysql - Wordpress function to check if table is empty -
i running wp blog on mediatemple wp hosting. provide built-in function integrate google analytics code. need make changes ga tracking code in order anonymize users ip, want disable function , replace custom one.
here mt built-in function:
public function add_ga_tracking_snippet_to_head() { if ( get_option( $this->plugin->name . '_web_property_id_head' ) !== false ) { $web_property_id = get_option( $this->plugin->name . '_web_property_id_head' ); ?> <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php echo $web_property_id ?>', 'auto'); ga('send', 'pageview'); </script> <?php } }
and here screenshot of db table ga id stored:
now, if delete id inside option_value table, function should not print <script>...</script>
, because of conditional statement if ( get_option( $this->plugin->name . '_web_property_id_head' ) !== false )
doesn't work way.
here's instead:
p.s. i've tried alter function isset
, !empty
no success. wrong?
the line get_option( $this->plugin->name . '_web_property_id_head' )
must false
conditional not execute.
empty strings , null
in mysql aren't boolean values they're never going !== false
.
Comments
Post a Comment