The motivations for this question are related to Constants of universal derivation on an $R$-algebra $A$ under localization ($d: S^{-1}A \to S^{-1}\Omega_{A/R}$)
Let $X$ be a geometrically integral curve of finite type over a finite field $k$ of characteristic $p$, and let $K = K(X)$ be the function field. For simplicity assume $X$ smooth and proper, though this shouldn't make a difference.
The standard derivation $$d:\mathcal{O}_X \to \Omega_{X/k}^1$$ extends to a derivation on the sheaf of rational functions and $$d:\mathcal{K}_X \to \Omega_{X/k}^1\otimes\mathcal{K}_X$$
The collection of elements whose derivative is zero forms a subfield, the field of constants $$L := \left\{a \in K| da = 0\right\} \subset K = \Gamma(\mathcal{K}_X).$$
It is easy to see that the subfield $K^{(p)}$ of $p^{th}$ powers is contained in $L$. The algebraic closure of $k$ in $K$ will also be contained in $L$, but this is just $k$, as we have assumed geometrically integral for simplicity.
Question: Under what conditions is it true that $K^p = L$?
I have considered using a finite map $X \to \mathbb{P}^1_k$ to realize $K$ as a finite extension of $k(t)$, and then reduce to the field $k(t)$, but even in this case I am unsure of how to make the proof go through. I have also considered using the Cartier isomorphism $$C^{-1}: \Omega^i_{X^{(p)}/k} \xrightarrow{\cong} \mathcal{H}^i_{dR}(X/k)$$ which for $i=0$ reduces to the isomorphism (of $\mathcal{O}_X^{(p)}$-modules) $$\mathcal{O}_X^{(p)} \xrightarrow{\cong} \mathrm{ker}(d) \subset \mathcal{O}_X,$$ which seems promising, but again I didn't see how to draw the conclusion.
Question 2: If $k$ is instead assumed to be of characteristic 0, under what conditions will we have $L = k$?
I would appreciate any help.